C# text file - how to write EOF character
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
If you needs to place that EOF char anyways, you could go with:
yourStream.WriteByte(0x1A); // dec 26
Just use the StreamWriter class, and Close the file appropriately. The EOF marker will be handled properly for you.
The EOF character is written automatically when using C#'s libraries to write to a text file.
if your stream is FileStream than you can simply:
yourStream.SetLength(someUlongLength);
精彩评论