Click to See Complete Forum and Search --> : filestream behaviour


laska98
April 22nd, 2004, 07:51 AM
I'm writing a file with this function, but the file is empty.....

bool SaveToFile(std::string fopen, bool mode)
{
FileStream *fs;
if (mode) fs = new FileStream(Convert::ToString(fopen.c_str()),FileMode::Create);
else fs = new FileStream(Convert::ToString(fopen.c_str()),FileMode::Append);
StreamWriter *sw = new StreamWriter(fs,System::Text::Encoding::ASCII);
sw->WriteLine(">>>");
sw->WriteLine(label4->Text);
sw->WriteLine(label5->Text);
sw->WriteLine(label6->Text);
fs->Flush();
fs->Close();
return true;
}


1) fopen is referenced with a valid path (savefile1->filename)
2) the three labels are filled correctly
3) also ">>>" is no written on file

many thanks

max

Andreas Masur
April 22nd, 2004, 05:32 PM
[Moved thread]

Andy Tacker
April 26th, 2004, 10:53 AM
try to put @ sign before <<<

sw->WriteLine(@">>>");