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
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);