P
Pieter Provoost
I'm having a little filestream problem. With the code below, I open a file
in order to insert its contents into another file. However, right after the
opening of the file, insertfile.eof() seems to be TRUE. Before the
problematic file is opened, one other file is opened and inserted by the
same piece of code (which is in a loop), without any problems. I'm sure that
the file to be inserted has several lines of contents, and I also checked if
the insertfile stream is closed before opening it.
if(FileExists(insertfilepath))
{
insertfile.open(insertfilepath.c_str());
while(! insertfile.eof())
{
getline(insertfile, insertline);
outfile << insertline << endl;
}
insertfile.close();
}
I would really appreciate some advise here.
Thanks,
Pieter
in order to insert its contents into another file. However, right after the
opening of the file, insertfile.eof() seems to be TRUE. Before the
problematic file is opened, one other file is opened and inserted by the
same piece of code (which is in a loop), without any problems. I'm sure that
the file to be inserted has several lines of contents, and I also checked if
the insertfile stream is closed before opening it.
if(FileExists(insertfilepath))
{
insertfile.open(insertfilepath.c_str());
while(! insertfile.eof())
{
getline(insertfile, insertline);
outfile << insertline << endl;
}
insertfile.close();
}
I would really appreciate some advise here.
Thanks,
Pieter