Im beginner in C++ I have code:
std::ifstream inFile(makeFolder/"file");
std::string str[3];
while(!inFile.eof())
{
for(int i = 0; i < 1; ++i)
inFile >> str[i];
}
for(int i = 0; i < 3; ++i)
std::cout << str[i];
and text file with:
123\n
456\n
789\n
When I execute this program I have out to console:
123
456
789
But if I change i
to 2 in cycle where I init str
I have this out:
789
456
And if I change i
to 1 in cycle where I init str
I have this out:
789
Why I have this out? I must be see out if I input i=1
123 and if i=2
456.