但是,在某些情况下,例如在处理整数或压缩文件时,需要能够读取和写入二进制数据。
In certain situations, however — for example, when you're working with integers or compressed files — you need to be able to read and write binary data.
可以用file对象读取数据、写入数据或把数据添加到文件,以及处理二进制或文本数据。
You can use the file object to read data, to write data, to append data to a file, and to work with either binary or textual data.
文本段同样会将二进制文件映射到内存,但文件映射区域的写入操作只能以程序收到段错误而告终。
The text segment also maps your binary file in memory, but writes to this area earn your program a Segmentation Fault.
应用推荐