gpt4 book ai didi

c - 我如何按 block 读取c中的图像文件?

转载 作者:行者123 更新时间:2023-11-30 20:35:12 25 4
gpt4 key购买 nike

我想用c读取图像,但在有限字节中这意味着读取n个字节直到结束所有图像

FILE *stream ;

FILE *stream1;

stream= fopen(pFile, "rb");

//when stream still bytes in stream

do

{

numread = fread( stream1, sizeof( char ), 64, stream );

//treat the stream1

}

最佳答案

你基本上需要这个:

FILE *stream1;

stream1 = fopen(pFile, "rb");

if (stream1 == NULL)
{
printf("Failed to open file");
return 1;
}

int numread;

do
{
char buffer[64];
numread = fread(buffer, sizeof(char), 64, stream1);

// now buffer contains the 'numbytes' bytes you have read

} while (!feof(stream1)):

关于c - 我如何按 block 读取c中的图像文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40153837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com