Mac OS的行尾以回车字符结束,许多文本处理工具将这样的文件作为一行来处理。
Mac OS ends lines with the carriage return character, and many text processing tools treat such files as a single line. To fix that, we can use the following tricks.
也可处理以空格、分号、制表符、回车或任何其他可识别字符分隔的列表。
A list separated by Spaces, semicolons, tabs, carriage returns, or any other identifiable character can be processed.
还可以注意到,write系统调用的结果是写入字符的个数数目,在这个示例中为17加上一个回车。
Also note that the result of the write system call is the number of characters written — in this case, 17 plus one carriage return.
Every time you hit the enter key in Notepad or in Microsoft Word, small white lie, those two characters end up getting saved in the file.
在Notepad或Microsoft里,每当你敲回车键时,没有恶意哈,这两个字符,都会保存在文档里。
应用推荐