我想在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
}
答案 0 :(得分:0)
你基本上需要这个:
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)):