How to read nested structure data from text file in C programming language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to read nested structure data from text file in C programming language?

i have created txt file using nested structure. Now i want to read that data.so how to use fread() function to read that nested structure ..plz plz help.....Thanks in advance

3rd Mar 2019, 3:00 PM
RBM
RBM - avatar
2 Answers
+ 5
Good, so you wanna read a txt file, in order to do so you follow these steps : 1 - Open the text file using the fopen() function 2 - use the function fgets() to read text from the stream and store it as a string. The newline or EOF character makes the fgets() function stop reading so you can check the newline or EOF file character to read the whole line. 3 - close the text file using the fclose() function. Clear?
3rd Mar 2019, 3:09 PM
Ubeid
Ubeid - avatar
+ 1
https://code.sololearn.com/cqVgjCtm97WZ/?ref=app here is problem.. . when i write new record it can read but when i add record and read that data ..there is problem .it will display unwanted
3rd Mar 2019, 3:50 PM
RBM
RBM - avatar