用C ++拆分文件 [英] Splitting a file in C++
本文介绍了用C ++拆分文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将包含整个文件(.exe / .jpg / .avi / .docx等)的数组拆分为2维矩阵(2d数组)的行。
这只是为了应用一些密码(加密)操作。
How to split an array containing an entire file (.exe/.jpg/.avi/.docx etc) into rows of a 2 dimensional matrix (2d array).
This is just to apply some cipher (encryption) operations.
推荐答案
您已经在加密二进制文件。 [ ^ ]。
但是,文件只是一个字节流,所以你只需将它读入一个字节数组然后根据你的内容操作内容要求。标准CRT库fread function
[ ^ ],或WindowsReafFile函数
[ ^ ],会做你想做的事。
You have already asked this question at Encrypting a binary file.[^].
However, a file is just a stream of bytes, so you just need to read it into a byte array and then manipulate the contents according to your requirements. The standard CRT libraryfread function
[^], or the WindowsReafFile function
[^], will do what you want.
这篇关于用C ++拆分文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文