问题描述
我面临一个奇怪的问题。这就是:
我正在为一个客户端编写ac#app,我会用它来读取一些数据和
为它们生成一个.dat文件数据。然后客户端将读取
..dat文件,并根据它们的内容做一些事情。我的
应用程序将在windows xp机器上运行,但是客户端应该能够在unix框中读取这个dat文件。所以,他们想知道最终会是什么结果
的行字符(我说这将是标准的\\\\ n),但他们也坚持
on知道什么是文件字符的enf。
现在,我已经读过c#中没有特定的EOF字符,那么应该怎么说?b $ b我告诉我的客户。他们说他们需要知道这一切,因为他们将在unix盒子上读取这个dat文件。
请赐教。
谢谢
dev_kh
有一个EOF字符不是没有''与使用C#,
或Unix或其他任何事情有关。它只是一个使用特殊字符的模式,
表示文件的结尾。我不完全确定它最初来自哪里,但它可能是串行通信 - 类似于
的模式,当时使用的xon / xoff字符没有RTS / CTS线路
可用。
现在,如果那些人想要一个EOF角色,只需在文件中写一个。
显然,这个字符必须与文件中的其他
数据清晰可辨,因此选择可能并不容易。如果他们只能使用文件IO方法可以在没有这样一个角色的帮助下找到文件的结尾,那肯定会更容易,但如果他们可以' '$
这样做,自己写这个角色没问题。
Oliver Sturm
-
提供专家编程和咨询服务
见(尝试/博客)
有一个EOF角色没有任何东西使用C#,
或Unix,或其他什么。它只是一个使用特殊字符来表示文件结尾的模式。我不完全确定它最初来自哪里,但它可能是串行通信 - 类似于没有RTS / CTS行时使用的xon / xoff字符的模式
现在,如果那些人想要一个EOF角色,只需在文件中写一个。
显然,这个角色必须与其他
数据区别开来。在文件中,所以选择可能不是一件容易的事。如果他们可以使用文件IO方法在没有这样一个角色的帮助下找到文件的结尾,那肯定会更容易,但如果他们不能这样做的话,自己写这个角色没问题。
Oliver Sturm
-
提供专业的编程和咨询服务
参见(尝试/博客)
Hi,
I am facing a weird issue. Here it goes:
I am writing a c# app for a client with which I will read some data and
generate a .dat file for them from that data. Then the client will read that
..dat file and do something based on it''s contents at their end. My
application will run on a windows xp machine but client should be able to
read this dat file in unix box. So, they want to know what will be the end
of line character (which I said will be standard \r\n), but they also insist
on knowing what is enf of file character.
Now, I have read that there is no specal EOF character in c#, so what should
I tell my client. They said they need to know all this as they will be
reading this dat file on a unix box.
Please enlighten me.
Thanks
dev_kh
Having an EOF character or not doesn''t have anything to do with using C#,
or Unix, or whatever. It''s just a schema that uses a special character to
signal the end of a file. I''m not entirely sure where that originally came
from, but it might have been serial communications - a pattern similar to
the xon/xoff characters that were used when there were not RTS/CTS lines
available.
Now, if those guys want an EOF character, just write one to the file.
Obviously, this character must be cleary distinguishable from the other
data in the file, so the choice might not be an easy one. It would
certainly be easier if they could just use file IO methods that can find
the end of a file without the help of such a character, but if they can''t
do it, it''s no problem to write the character yourself.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Having an EOF character or not doesn''t have anything to do with using C#,
or Unix, or whatever. It''s just a schema that uses a special character to
signal the end of a file. I''m not entirely sure where that originally came
from, but it might have been serial communications - a pattern similar to
the xon/xoff characters that were used when there were not RTS/CTS lines
available.
Now, if those guys want an EOF character, just write one to the file.
Obviously, this character must be cleary distinguishable from the other
data in the file, so the choice might not be an easy one. It would
certainly be easier if they could just use file IO methods that can find
the end of a file without the help of such a character, but if they can''t
do it, it''s no problem to write the character yourself.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
这篇关于c#中的eof字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!