更新时间:2023-11-13 10:15:46
阅读文章。
你必须首先分配一个足够大的文件数据缓冲区而不是读取它。
如果你使用jpeg那么伟大的文章 Imagestone 可能对您有所帮助。
Read this article.
You must at first allocate a buffer which is big enough for the file data and than read it in.
If you work with the jpeg the great article Imagestone may help you.
您可以阅读每个文件数据只需使用标准的ifstream
设施(在Windows
上你必须使用 二进制mo德的)。
另一方面,如果你需要从图像文件提取信息(例如像素颜色),那么你必须使用特定的API
(例如GDI +
提供的那个)。
You may read every file data into a byte buffer simply using standardifstream
facilities (onWindows
you have to use the "binary mode").
On the other hand, if you need to extract info (e.g. pixel colors) from an image file then you have to use a specificAPI
(e.g. the one provided byGDI+
).