|
From: airam <ai...@so...> - 2003-02-22 10:49:35
|
Messagehi!!!!
i want to read a file every 4bytes and get the integer that represent =
4bytes this is the code (compile successfully)but i don't see =
nothing!!!!!
whereis is wrong!!!!some help please!!!!
english is not my native language sorry!!!
#include <stdio.h>
#include <stdlib.h>
=20
int main () {
FILE * f;
long size;
int * buffer;
int countt;
int x;
unsigned int j;
unsigned int k;
=20
f =3D fopen ( "filename" , "rb" );
if (f=3D=3DNULL) exit (1);
fseek (f , 0 , SEEK_END);
size =3D ftell (f);
countt=3Dsize/4;
rewind (f);
while (!feof(f) && !ferror(f))
{
k=3Dfread(&j, sizeof(x), countt, f);
}
printf("%d\n",k);
fclose (f);
free (buffer);
return 0;
}
=20
|