Reading files with DOS line endings using fgets() on linux

后端 未结 4 587
小蘑菇
小蘑菇 2021-01-22 16:15

I have a file with DOS line endings that I receive at run-time, so I cannot convert the line endings to UNIX-style offline. Also, my app runs on both Windows and Linux. My app d

4条回答
  •  滥情空心
    2021-01-22 16:43

    On Unix, the lines would be read to the newline \n and would include the carriage return \r. You would need to trim both off the end.

提交回复
热议问题