Vijay Guest
|
Posted: Thu Dec 16, 2004 9:47 pm Post subject: Null Character |
|
|
Hello,
I have been writing list<string> to a file using the following code:
bool save_to_file(
std::string const & filename,
std::list<std::string> & list)
{
std::ofstream strm(filename.c_str());
if (!strm)
{
return false;
}
copy(list.begin(), list.end(), ostream_iterator<std::string>(strm,
"n"));
return strm.eof();
}
Until recently this was working fine, but now, all of a sudden, it
started giving me "null character" in the output along with the end of
line. I haven't changed my code, can you please send me your thoughts
on what is going wrong. I would also greatly appreciate if you can
send me any alternate method for writing a list of strings to a file.
I am using C++ Builder 5.0 ( Build 12.34) on Windows 2000.
Thanks,
Vijay
|
|