Hello, all. I'm having a bit of a problem (why else would I have made a new thread? :D). How can I get fopen to return the contents of the file it read as a string? I've tried several things, but nothing seems to work.
Printable View
Hello, all. I'm having a bit of a problem (why else would I have made a new thread? :D). How can I get fopen to return the contents of the file it read as a string? I've tried several things, but nothing seems to work.
fopen doesn't read anything. It simply opens a file.
Quzah.
Once you have opened a file with fopen, if you want strings, read up on fgets()
fgets - C++ Reference
Or if you want straight up input from the file, use fscanf (functions exactly like scanf, but on the current "place" you are at in your file).