由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - [转载] Hidden character in a file
相关主题
wget question面试题
What does this mean?java初学者求指点这段code
一个关于R的小问题关于automatic conversion
相关话题的讨论汇总
话题: file话题: character话题: text话题: hidden话题: end
进入Unix版参与讨论
1 (共1页)
d*o
发帖数: 108
1
【 以下文字转载自 Programming 讨论区 】
【 原文由 duo 所发表 】
Need to understand the following questions to program in C/C++:
1. Does any text file always end with a '\n'? i.e. if a text file
contains only one character, any editor will automatically add
a '\n' at the end of a file?
2. Is there a charater in a text file called 'end of file'? Use
the above example, if a text file has only one character 'a',
how many characters for this file? i.e. is it 'a' + '\n'?
or is it 'a' + '\n' + '\eof'?
Thanks for all help!
e***o
发帖数: 14
2

no ( unless you hit the enter key
at least not in vi and emacs
EOF (end of file) is not a character.
So if you only type a in a new file, the there is only an a in this
file and nothing else.

【在 d*o 的大作中提到】
: 【 以下文字转载自 Programming 讨论区 】
: 【 原文由 duo 所发表 】
: Need to understand the following questions to program in C/C++:
: 1. Does any text file always end with a '\n'? i.e. if a text file
: contains only one character, any editor will automatically add
: a '\n' at the end of a file?
: 2. Is there a charater in a text file called 'end of file'? Use
: the above example, if a text file has only one character 'a',
: how many characters for this file? i.e. is it 'a' + '\n'?
: or is it 'a' + '\n' + '\eof'?

1 (共1页)
进入Unix版参与讨论
相关主题
What does this mean?java初学者求指点这段code
一个关于R的小问题关于automatic conversion
面试题wget question
相关话题的讨论汇总
话题: file话题: character话题: text话题: hidden话题: end