我可以为第二个文件分配相同的文件指针吗?

T.T*_*.T. 2 c file-io text 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? 

     }

}
Run Code Online (Sandbox Code Playgroud)

编辑:
不打印到第二个文件...但是,fprint()不返回负值.

jer*_*jer 5

是的,您可以确保在执行此操作之前关闭第一个文件.