Can someone please help me with the usage of fread?
like errm, explain why my small test code don't quite work.
It's just reading a series of numbers(int) from a file.
many thanks!Code:int main(int argc, char **argv) { FILE *fp; int *number = (int *)malloc(sizeof(int)); int n; fp = fopen(argv[1], "r"); while((n = fread(&number, sizeof(int *), 1, fp)) > 0); printf("n: %d -- %d\n", n, number); return 0; }



LinkBack URL
About LinkBacks



