txt looks normal on Linux but weird on Windows. WHY?
2 ビュー (過去 30 日間)
古いコメントを表示
I created txt. file using fopen, fwrite and fclose running MATLAB on Linux. However, the lines are mixed up when opening the file on Windows. Is there any work around? I need to be able to work with the txt. file on both WIndows and Linux.
1 件のコメント
採用された回答
Walter Roberson
2013 年 6 月 24 日
On the Linux side, each place that you currently write out '\n', change it to '\r\n'. That is, instead of char(10) use char([13 10])
0 件のコメント
その他の回答 (1 件)
Jan
2013 年 6 月 24 日
What does "opening the file in Windows" exactly mean? While all editors I know, even vi, XEmacs on Windows, MS Word Alpha on my old MacOS-8 computer and the preview on LCD of the fancy Ricoh printer handle Linux/Windows linebreaks correctly, Window's Notepad fails. If you mean this limitations of Notepad, I share your curiosity: Why does Microsoft ships such a bad program with Windows?
Btw. I did not test this in Windows8 yet.
1 件のコメント
Stephen23
2022 年 3 月 5 日
Finally fixed with Windows10 in 2018: https://devblogs.microsoft.com/commandline/extended-eol-in-notepad/
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!