文件和FileStream帮助 [英] File & FileStream Help

查看:69
本文介绍了文件和FileStream帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

关于File.ReadLines(< filename>)为什么成功逐行成功返回文件内容的任何想法,但是当FileStream.Read(byte [],offset ,计数),那么CR/LF是否不会复制到缓冲区中?

Any ideas why the File.ReadLines(<filename>) successfully returns the content of the file line-by-line but when the same file is read in large chunks by FileStream.Read(byte [], offset, count), the CR/LF is NOT copied into the buffer?

在文本编辑器的二进制视图中打开文本文件,我已经验证了0x0D和0x0A字符的存在.我以为是有一些编码问题,但文件未指定BOM.

Opening the text file in a text editor's binary view, I've verified the existence of the 0x0D and 0x0A characters.  I was think there was some encoding issue but the file does not specify a BOM.

谢谢.

推荐答案

Hi

如果我没记错的话,CR/LF将表示为13&. 10字节.

If I am not wrong, CR/LF will be represented as 13 & 10 in byte.

当您将文件内容读入字节数组时,CR/LF将以13、10的顺序依次添加到字节数组中.

When you read file content into byte array, CR/LF will be added to byte array as 13, 10 next to each other in order.

希望这对您有所帮助.

Hope this helps you. 


这篇关于文件和FileStream帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆