Read/Write text file in C programming

后端 未结 3 851
攒了一身酷
攒了一身酷 2021-01-13 17:17

I need to write something into a txt file and read the contents, then print them on the screen. Below is the code I have written, it can create and write contents into file

3条回答
  •  礼貌的吻别
    2021-01-13 18:01

    You need to seek back to the beginning of the file after you write to it and before you start reading:

    fseek(inFile, 0, SEEK_SET);
    

提交回复
热议问题