Recently in a project, need to read the Tex file, but the function of each call, open a file, after the call will find that the call will not open the file, the data is not read at all, and then take a most stupid method, each call function re-use fopen open a file, and finally really crazy, Find the information on the Internet, understand the principle. When we use a pointer to open a file, it is through the movement of the pointer to read the data inside, if you use this pointer again, you have to initialize the pointer, put the pointer to the initial position. After each use of the pointer to read the file, add a sentence behind the program
Fseek (Fp,0,seek_set);
Add this sentence, you call once fopen can read the file multiple times, but remember not to use Fclose to close the file, shut down you will not happy, must be reopened. Understand these are not very happy, do not see so many fopen, want to open several times.