I want to use C++ to read an XML file, but when I type the following:
char infile[] = "util_sip.xml";
ifstream in(infile);
char buffer[256];
assert(in.si_open());
while(!in.eof()){
in.getline(buffer, 256);
cout<<buffer<endl;
}
It doesn't work and it prints nothing on my screen and causes an infinite loop. However, if I type:
while(in.getline(buffer,strsize)){
cout<<buffer<<endl;
}
It works again. I don't know why it doesn't work when I run the first example.