J
jtan212
Should i use the function getline?
the length of a line is unknown.
how to use it?
can someone show me a example?
the length of a line is unknown.
how to use it?
can someone show me a example?
[email protected] said:Should i use the function getline?
the length of a line is unknown.
how to use it?
can someone show me a example?
does it work even if a line contains a space ?mlimber said:Yes, use getline, but use it with a std::string:
#include <string>
#include <fstream>
using namespace std;
int main()
{
ifstream file( "file.txt" );
// Do error checking here
string str;
while( getline( file, str ) )
{
// ...
}
return 0;
}
does it work even if a line contains a space ?
When I compile this program, an error happened:
d:\c++work\gltest.cpp(20) : fatal error C1010: unexpected end of file
while looking for precompiled header directive
what does this error mean?
can some one give me help? Thank u!
When I compile this program, an error happened:
d:\c++work\gltest.cpp(20) : fatal error C1010: unexpected end of file
while looking for precompiled header directive
what does this error mean?
can some one give me help? Thank u!
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.