Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# text file - how to write EOF character

Tags:

c#

This has got to be an easy question but I'm not finding anything out there.

I have a text file. I need to put a EOF character at the end so a third party vendor can read the file correctly.

What is the escape character needed to write the end of file character?

I'm not sure if I need to supply any more information, but if I do, let me know.

Thanks

like image 749
Miles Avatar asked Feb 03 '10 18:02

Miles


2 Answers

If you needs to place that EOF char anyways, you could go with:

yourStream.WriteByte(0x1A); // dec 26
like image 74
Rubens Farias Avatar answered Sep 19 '22 18:09

Rubens Farias


Just use the StreamWriter class, and Close the file appropriately. The EOF marker will be handled properly for you.

like image 30
Reed Copsey Avatar answered Sep 19 '22 18:09

Reed Copsey