A
Adrian
All,
This code below produces "GOOD" on one platform and "EOF" on the
other.
I expect it to produce "EOF" as the second read would hit the end of
the stream.
Which result is correct?
Adrian
#include <iostream>
#include <sstream>
int main(int argc, char *argv[])
{
std::stringstream strm("5 4");
int x;
strm >> x;
strm >> x;
if(strm.good())
{
std::cout << "GOOD\n";
}
if(strm.eof())
{
std::cout << "EOF\n";
}
return 0;
}
This code below produces "GOOD" on one platform and "EOF" on the
other.
I expect it to produce "EOF" as the second read would hit the end of
the stream.
Which result is correct?
Adrian
#include <iostream>
#include <sstream>
int main(int argc, char *argv[])
{
std::stringstream strm("5 4");
int x;
strm >> x;
strm >> x;
if(strm.good())
{
std::cout << "GOOD\n";
}
if(strm.eof())
{
std::cout << "EOF\n";
}
return 0;
}