Is there a way to read the whole line from a .txt file, that contains spaces and write it to one string? Is there a function for it or do I have to try some longer code.
This is a discussion on fscanf whole line within the C++ Programming forums, part of the General Programming Boards category; Is there a way to read the whole line from a .txt file, that contains spaces and write it to ...
Is there a way to read the whole line from a .txt file, that contains spaces and write it to one string? Is there a function for it or do I have to try some longer code.
Don't use fscanf(). Since you posted this in the C++ section, you're best off with getline() or something. Otherwise, if you're really using C, use fgets().