text file output - or it would be if comp wasnt being stubborn

can you tell me why I am not getting any output to a text file? I cant see why its not doing it.

void __fastcall TmainForm::Save1Click(TObject *Sender)
{
/* if (SavePic->Execute ())
{*/
FILE* outfile = NULL;
outfile = fopen ("c:\123\etext.txt", "w");
if (outfile == NULL) ShowMessage ("Error opening file");
else
{
ShowMessage ("File found, comp being pathetic");
fprintf (outfile, "999\n");
}
fclose (outfile);
}

thanks
\ is used for escape characters like \n. If you want backslash you have to write \\. It is also possible to use forward slashes in file paths.
"c:\\123\\etext.txt"
"c:/123/etext.txt"
thanks :)
Topic archived. No new replies allowed.