0

I am having problems with a code using fscanf, Can anyone please help?

I have written a basic c program that keeps record of students using file handling, but I'm unable to make a successful program to read that data and print on console. I am attaching the program I need help with!! https://code.sololearn.com/c0Pt1RZctiW5/?ref=app https://code.sololearn.com/cSV07Dt5YEAu/?ref=app

1st Aug 2018, 4:14 PM
Anand Dwivedi
Anand Dwivedi - avatar
4 Answers
+ 2
Anand Dwivedi , it's working elsewhere or not? there is some limitations of sololearn code playground (like it doesn't allow interactive user input)... if it's not working anymore on other platform, do let us know and someone might look into it in detail for you to help..
5th Aug 2018, 7:01 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 2
Anand Dwivedi additionally, if you have opened file, it's a good practice to close it once you are done reading the same..
5th Aug 2018, 7:49 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Anand Dwivedi okay..as you mentioned it reads infinity, I hope you have got proper file pointer.. I dont have any other platform as of now, but I predict culprit is &name in fscanf.. can you try to pass name instead of &name and share your results?
5th Aug 2018, 7:48 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Thanks Ketan Lalcheta, it's not working any-where I'm unable to make a program to read the details I input . The fscanf reads infinitely. Thanks https://code.sololearn.com/c0Pt1RZctiW5/?ref=app
5th Aug 2018, 7:19 AM
Anand Dwivedi
Anand Dwivedi - avatar