如何读取JPEG文件并存储在CString变量中? [英] How to read the JPEG file and store in CString variable?

查看:117
本文介绍了如何读取JPEG文件并存储在CString变量中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何读取JPEG文件并存储在CString变量中?我想从硬盘驱动器中读取JPEG文件并在CString中读取它.但是我已经尝试过使用CFile,但是二进制数据很好地存储在char数组中,但是在复制到CString时却失败了,
char数组中只有前4个字符被复制到CString变量中.
如何执行此操作?

How to read the JPEG file and store in CString variable? I want to read the JPEG file from the hard drive and to read it in CString. But i have tried with CFile but the binary data is stored very well in char array but while copying to CString it fails,
only first 4 characters in char array is being copied into the CString variable.
How to perform this??

推荐答案

这听起来像是在做些迟钝的事情.您知道您的CString将包含垃圾,而不是以任何有意义的方式包含图像吗?为此,您需要对其进行UUEncode编码,从而使其变大,但又能够将其存储为字符串.然后,您将获得JPEG的表示形式,可以将其解码并返回到CString中的JPEG字节.但是,它实际上并不是原始JPEG中的信息,更不用说以任何方式用作图像了.
This sounds like a retarded thing to do. You know that your CString will contain garbage, not the image in any meaningful way ? To do this, you''d need to UUEncode it, thus making it bigger, but making it able to be stored as a string. Then you''d have a representation of a JPEG that it''s possible to decode and turn back in to the bytes of a JPEG, inside a CString. But, it would not actually be the information in the original JPEG, let alone useful in any way as an image.


这篇关于如何读取JPEG文件并存储在CString变量中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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