fopen是一个库函数。
不是系统调用,系统调用是没有什么b或者有b一说的。
库函数严格意义上来说,就要分平台实现了,虽然现在有各种各样的标准,比如POSIX, ANSIC等等,但是还是要有这种库函数分平台的意识。
就fopen这个函数就在不同的平台就有不同的实现
win平台:
我基本没有怎么用过,搜了下网上这篇文章:
https://blog.csdn.net/u012372584/article/details/77836168
整体上就是对于回车换行在读写的时候会有不同的操作,其它的不得而知。
linux平台:
有没有b都是一样的,没有文本方式二进制方式一说。
The mode string can also include the letter 'b' either as a last character or as a character between the characters in any of the two- character strings described above. This is strictly for compatibility with C89 and has no effect; the 'b' is ignored on all POSIX conforming systems, including Linux. (Other systems may treat text files and binary files differently, and adding the 'b' may be a good idea if you do I/O to a binary file and expect that your program may be ported to non-UNIX environments.)
这个是fopen在linux上面官方文档的说明。
POSIX:
对fopen使用b的介绍为:
The character 'b' shall have no effect, but is allowed for ISO C standard conformance. Opening a file with read mode (r as the first character in the mode argument) shall fail if the file does not exist or cannot be read.
也是没有什么用,但是可以带。