开发者

C# text file - how to write EOF character

开发者 https://www.devze.com 2022-12-18 20:10 出处:网络
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开发者_如何学编程 co

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号