Visual c + + I / O二进制文件? [英] Visual c++ I/O Binary file?

查看:132
本文介绍了Visual c + + I / O二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要二进制的I / O文件(意思是0和1)。

我也想编辑这些0和1的文件。

我有不知道该怎么做...请帮助我。

I want to I/O files in binary(means in 0s and 1s).
I also want to edit these 0s and 1s of files.
I have no idea how to do that... please help me.

推荐答案

你拥有所需的一切 std :: ofstream std :: ifstream std :: fstream

http://www.cplusplus.com/doc/tutorial/files/ [ ^ ]。



我希望你也知道按位算术和按位运算符。如果没有,倾斜他们。 Streams为您提供每字节访问权限,因此您可以读取一个字节,提取单个位,以您希望的方式修改它们并写入整个字节。这是所有开发人员应该掌握的最基本的技能之一。



参见,例如:http://www.cplusplus.com/doc/tutorial/operators/ [ ^ ]。



-SA
You have everything you need with std::ofstream, std::ifstream and std::fstream:
http://www.cplusplus.com/doc/tutorial/files/[^].

I hope you also know bitwise arithmetic and bitwise operators. If not, lean them. Streams give you per-byte access, so you can read a byte, extract individual bits, modify them the way you want and write the whole byte. This is one of the most basic skills all developers are supposed to master.

See, for example: http://www.cplusplus.com/doc/tutorial/operators/[^].

—SA


你通常不直接编辑1和0。



当想要编辑二进制文件时,人们使用Hex编辑器 [ ^ ],您可以在其中编辑二进制文件的十六进制表示。
You usually do not directly edit the 1s and 0s.

When wanting to edit a binary file, people use a Hex Editor[^] where you can edit the hexadecimal representation of the binary file.


这篇关于Visual c + + I / O二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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