Can I assign the same file pointer a second file?
function()
{
 FILE *ptr;
 ptr = fileopen(file1.txt)
 fprint(ptr, some text) //print to file 1
     if(second file needed)
     {
        ptr = fileopen(file2.txt) //open a second file, assign to same file pointer
        fprint(ptr, some text) //print to file 2  not working here? 
     }
}
EDIT:
No开发者_如何学JAVAt printing to second file...However, fprint() does not return a negative value.Yes you can, however, you should ensure that the first file is closed before doing so.
You can do that, but the problem is that you've lost a way to access the 1st opened file (even if just to close it).
Yes all pointers are simply variables that hold a memory address.  At first your pointer holds the first memory address that fileopen (I guess you probably meant fopen though?) returns.  You can put a different memory address in it later.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论