[转载] Hidden character in a file# Unix - 噫吁兮,危乎高哉
d*o
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!
【 原文由 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!