Tob*_*oby 2 iphone file-io newline
我需要在我的 iPhone 应用程序中创建和导出一个 excel 文件。不幸的是,如果行编码是 LF(我编写文件时的 unix 默认值)而不是 CRLF(Windows 标准),excel 将不会读取它……有没有办法使用 CRLF 换行符来编写文件?
我可以说这是问题,就好像我在输出后在 TextWrangler 中打开文件,然后将换行符更改为 CRLF,excel 可以正常打开它。
谢谢,
托比
如果您在 C 中使用 printf 或 fprintf,您通常会像这样终止行:
printf( "this is a line of text.\n" );
Run Code Online (Sandbox Code Playgroud)
所述\n输出换行。您可以使用 输出回车符\r,因此要获得 CRLF,您只需:
printf( "this is a CRLF terminated line.\r\n" );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5439 次 |
| 最近记录: |