+ 1
Help me with file operations in C
I have this file myfile.txt with a three lines of data. But when I run this code to read the data character by character and print it, it prints infinite small question marks. I don't know why. Help me figure it out https://code.sololearn.com/c8d95yWpaD63/?ref=app
3 Réponses
+ 3
Can you show use the content of the file ?
What do you see when you put "abc" in the file.
GetC stands for
"Get character"
Why should it read line by line?
+ 1
sneeze the file's contents are
Inventory
100 Widget 0.29
End of List
I expect it to read character by character only. But for some reason I get unknown charcters printed infinitely. Could it be the type of c? Should it be int instead of char?
+ 1
sneeze okay thank you I got it. The type of c should be int instead of char as fgetc returns the ASCII values of the characters