User1814019480 posted
Hi EducateMe,
Thanks for your posting.
I modified your code and tested it. The result was well.
I think if you open the file always,you can not see the changes of TXT file.
I think you need to close file before you put a page break and step through it manually(F11),So you can get result normally.
You can open the txt file afer you put a page break and step .
The blow code is my test.
this code is ok:
while (count != 8)
{
File.AppendAllText(@"C:\Users\XXX\Desktop\temp.txt", "content");
count++;
}
And there is another way of writing text in txt file .you can refer to it.
StreamWriter sw = new StreamWriter(@"C:\Users\xxx\Desktop\temp1.txt");
sw.WriteLine("----------------hello----------------");
sw.WriteLine("content");
sw.WriteLine("----------------end----------------");
sw.Flush();
sw.Close();
Hop this helps.
Regards!