Windows中的`fprintf()`和`fscanf()`是否需要以文本模式打开文件 [英] Does `fprintf()` and `fscanf()` in Windows require a file to be opened in text mode

查看:111
本文介绍了Windows中的`fprintf()`和`fscanf()`是否需要以文本模式打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows中对文本文件使用fprintf()fscanf()时,与二进制模式相比,是否有必要或建议以文本模式打开文件?

When using fprintf() and fscanf() on text files in Windows, is it necessary or recommended to open the file in text mode compared to binary mode?

答案是否取决于在Windows中使用Microsoft对标准C库或GNU Libc的实现?

Does the answer depend on using Microsoft's implementation of the standard C library or GNU Libc in Windows?

推荐答案

在Windows中对文本文件使用fprintf()和fscanf()时,与二进制模式相比,是否有必要或建议以文本模式打开文件?

When using fprintf() and fscanf() on text files in Windows, is it necessary or recommended to open the file in text mode compared to binary mode?

fprintf / fscanf 基于低级函数 fputc / fgetc 等,因此该模式的管理文本/二进制遵循我们在

fprintf / fscanf are based on low level function fputc / fgetc etc so the management of the mode text/binary follow the same rules we see in Do fgetc, fputc, fgets and fputs require a file opened in text mode, and fread and fwrite require a file in binary mode?

答案是否取决于在Windows中使用Microsoft对标准C库或GNU Libc的实现?

Does the answer depend on using Microsoft's implementation of the standard C library or GNU Libc in Windows?

mingw libc在我的Microsoft libs中受支持,其行为是Microsoft libc之一,某些功能遵循ISO但不是GNU/gcc,这是一种实现,不是一种标准.请注意,通常,Microsoft并不完全符合任何特定的POSIX标准(请参见 Microsoft文档中的兼容性)

The mingw libc are supported my the Microsoft libs, the behavior is the one of the Microsoft libc, some function follow ISO but not GNU / gcc which is an implementation, not a standard. Note generally Microsoft is not fully conformant to any specific POSIX standard (see Compatibility in Microsoft Docs )

这篇关于Windows中的`fprintf()`和`fscanf()`是否需要以文本模式打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆