What code are you using? I suspect that you didn't call the Close()
method right after you created the file. We can't do much without seeing the actual code you use. But anyways, here's a sample code I use when creating/writing text files:
FileStream fs
= null;
string tmpFile
= "C:\\sample.txt";
// Create file and close it so that it can be re-opened for writing further on
fs
= File.Create(tmpFile
, 1024);
fs.Close();
// Prepare file for writing by assigning a new textWriter to it
TextWriter wr
= new StreamWriter(tmpFile
);
// Write stuff into the file
wr.WriteLine("Stuff 1"); wr.WriteLine("Stuff 2"); wr.WriteLine("Blah blah blah......");
// Eventually close the file
wr.Close();
Regards, Polis Can you practice what you teach? -- modified at 9:53 Thursday 15th December, 2005