g*******s 发帖数: 59 | 1 i am using visual studio 2005 to test the use of getline.
The text file is like:
test.txt
a is a file
1.0 2.0
b isnot a file
3.0 4.0
The codes r
#include
#include
#include
using namespace::std;
void main()
{
string zz,zz1;
ifstream fin("test.txt");
getline(fin,zz);
double a[2],b[2];
fin>>a[0]>>a[1];
cout<
// Now problem begins!
getline(fin,zz1);
fin>>b[0]>>b[1];
cout<
}
Could you explain this t | l****i 发帖数: 43 | 2 after your
cout<
The statement
getline(fin,zz1);
only get an return;
put another getline(fin,zz1) there, it will work. | g*******s 发帖数: 59 | 3 Thanks alot!
【在 l****i 的大作中提到】 : after your : cout<: The statement : getline(fin,zz1); : only get an return; : put another getline(fin,zz1) there, it will work.
|
|