C语言read函数
的有关信息介绍如下:read内部是调_read, _read的返回值在msdn中有这样的描述_read returns the number of bytes read, which might be less than count if there are fewer than count bytes left in the file or if the file was opened in text mode, in which case each carriage return–line feed (CR-LF) pair is replaced with a single linefeed character. Only the single linefeed character is counted in the return value. The replacement does not affect the file pointer.注意这一段: in which case each carriage return–line feed (CR-LF) pair is replaced with a single linefeed character就是说如果用text模式打开的话, 文件换行时可能在文本中有2个字符----换行和缩进(CR-LF), 而在return的时候系统是把它作为1个回车符号('\n')所返回的. 所以会导致这个情况