c#中的eof字符 [英] eof character in c#

查看:131
本文介绍了c#中的eof字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我面临一个奇怪的问题。这就是:


我正在为一个客户端编写ac#app,我会用它来读取一些数据和

为它们生成一个.dat文件数据。然后客户端将读取

..dat文件,并根据它们的内容做一些事情。我的

应用程序将在windows xp机器上运行,但是客户端应该能够在unix框中读取这个dat文件。所以,他们想知道最终会是什么结果

的行字符(我说这将是标准的\\\\ n),但他们也坚持

on知道什么是文件字符的enf。


现在,我已经读过c#中没有特定的EOF字符,那么应该怎么说?b $ b我告诉我的客户。他们说他们需要知道这一切,因为他们将在unix盒子上读取这个dat文件。


请赐教。


谢谢

dev_kh

解决方案

Hello dev_kh,


我百分百肯定C#中没有EOF字符。它也没有

的需要。只需阅读文件,直到没有任何东西。这就是全部。


问候,


Mark Monster



我正面临一个奇怪的问题。这就是:

我正在为一个客户端编写一个c#app,我将从中读取一些数据并从该数据中为它们生成一个.dat文件。然后客户端将读取该.dat文件并根据它们的内容在其结尾处执行某些操作。我的应用程序将在Windows XP机器上运行,但客户端
应该能够在unix框中读取此dat文件。所以,他们想知道什么是行尾字符(我说将是
标准\\ n),但他们也坚持知道什么是文件的enf />
现在,我已经读过c#中没有特定的EOF字符,所以我应该告诉客户什么。他们说他们需要知道这一切,因为他们将在unix盒子上读取这个dat文件。

请赐教。

谢谢
dev_kh



dev_kh写道:

我面临一个奇怪的问题。这就是:

我正在为客户编写一个c#应用程序,我将从中读取一些数据并从该数据中为它们生成.dat文件。然后客户端会读取
.dat文件并根据它们的内容做一些事情。我的
应用程序将在Windows XP机器上运行,但客户端应该能够在unix框中读取此dat文件。所以,他们想知道线条角色的最终结果(我说这将是标准的\\ n),但他们也坚持要知道什么是enf文件字符。

现在,我已经读过c#中没有特定的EOF字符,所以
应该告诉我的客户。他们说他们需要知道这一切,因为他们将在unix盒子上读取这个dat文件。




有一个EOF字符不是没有''与使用C#,

或Unix或其他任何事情有关。它只是一个使用特殊字符的模式,

表示文件的结尾。我不完全确定它最初来自哪里,但它可能是串行通信 - 类似于

的模式,当时使用的xon / xoff字符没有RTS / CTS线路

可用。


现在,如果那些人想要一个EOF角色,只需在文件中写一个。

显然,这个字符必须与文件中的其他

数据清晰可辨,因此选择可能并不容易。如果他们只能使用文件IO方法可以在没有这样一个角色的帮助下找到文件的结尾,那肯定会更容易,但如果他们可以' '$

这样做,自己写这个角色没问题。


Oliver Sturm

-

提供专家编程和咨询服务

http: //www.sturmnet.org (尝试/博客)


感谢各位回复我的查询。我知道在c#中不需要EOF

而且我不想写一个(因为选择哪个

唯一字符来识别为EOF的麻烦也是因为我需要连续更新

这个文件,我不想找到这个EOF,然后每次更新文件时都会移动它b / b
。问题是我的客户将在他们的

unix机器上读取这个.dat文件(将在Windows机器上生成)。所以这就是为什么他们坚持要找出哪个是
EOF角色。任何有关相同的意见。我做了一些研究并告诉

他们在Windows中默认为ASCII 26,即CTRL + Z自动插入

作为EOF。现在,如果他们想要,他们可以找到这个ASCII 26的unix等价物

并在我的c#生成的.dat文件中查找它。


我带了吗正确的方法...

谢谢

dev


Oliver Sturm写道:

dev_kh写道:

我面临一个奇怪的问题。这就是:

我正在为客户编写一个c#应用程序,我将从中读取一些数据并从该数据中为它们生成.dat文件。然后客户端会读取
.dat文件并根据它们的内容做一些事情。我的
应用程序将在Windows XP机器上运行,但客户端应该能够在unix框中读取此dat文件。所以,他们想知道线条角色的最终结果(我说这将是标准的\\ n),但他们也坚持要知道什么是enf文件字符。

现在,我已经读过c#中没有特定的EOF字符,所以
应该告诉我的客户。他们说他们需要知道这一切,因为他们将在unix盒子上读取这个dat文件。



有一个EOF角色没有任何东西使用C#,
或Unix,或其他什么。它只是一个使用特殊字符来表示文件结尾的模式。我不完全确定它最初来自哪里,但它可能是串行通信 - 类似于没有RTS / CTS行时使用的xon / xoff字符的模式<可用。

现在,如果那些人想要一个EOF角色,只需在文件中写一个。
显然,这个角色必须与其他
数据区别开来。在文件中,所以选择可能不是一件容易的事。如果他们可以使用文件IO方法在没有这样一个角色的帮助下找到文件的结尾,那肯定会更容易,但如果他们不能这样做的话,自己写这个角色没问题。

Oliver Sturm
-
提供专业的编程和咨询服务
参见 http://www.sturmnet.org (尝试/博客)



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

解决方案

Hello dev_kh,

I''m one hundred percent sure there is not EOF character in C#. There is no
need for it too. Just read the file till there is nothing left. That''s all.

Regards,

Mark Monster

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



dev_kh wrote:

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.



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)


Thanks Guys for replying to my query. I know that there is no need for EOF
in c# and I do not want to write one (becuase of hassle of choosing which
unique character to identify as EOF and also because I will need to update
this file continuosly and I do not want to have to find this EOF and then
move it every time I update the file). The problem is that my clients will
read this .dat file (which will be generated on a windows machine) on their
unix machine. So that''s why they are insisting on finding out which is the
EOF character. Any opinions about the same. I did some research and told
them that in windows by default ASCII 26 i.e. CTRL + Z is inserted
automatically as EOF. Now, if they want they can find the unix equivalent
of this ASCII 26 and look for it in my c# generated .dat file.

Did I take right approach...
Thanks
dev

"Oliver Sturm" wrote:

dev_kh wrote:

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.



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字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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