将文件转换为字节数组,反之亦然 - Native C ++ [英] convert file to byte array and Vice versa - Native C++

查看:86
本文介绍了将文件转换为字节数组,反之亦然 - Native C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

请帮助我,我想将.exe文件转换为字节数组,然后使用本机C ++将字节数组转换为.exe文件。在我的情况下,我使用FTP over serial gsm modem;我的方法是通过ftp服务器上传.exe文件的字节数组,然后通过
调制解调器下载文件,在这种情况下我将通过串口获得字节数组,这个接收到的字节数组我将重新构建成.exe。

Please help me I want to convert .exe file to byte array and then byte array to .exe file again using native C++. In my case I am using FTP over serial gsm modem; my way is to upload .exe file's byte array over ftp server and then download file via modem in this case I will get array of bytes over serial port and this received byte array i will reconstruct into .exe again.

请指导我如何将.exe转换为字节数组,反之亦然

Please guide me how can I convert .exe to byte array and vice versa

推荐答案

.exe文件是与任何其他文件没有区别。 您可以找到它的大小,分配足够大的缓冲区来容纳整个文件,然后将.exe文件内容读入缓冲区。
An .exe file is no different from any other file.  You can find it's size, allocate a buffer large enough to hold the entire file and then read the .exe file contents into the buffer.


这篇关于将文件转换为字节数组,反之亦然 - Native C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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