I'm trying to use someone elses code for turning binary to numbers and I don't really know what fread() is. I get what it's trying to do, but according to waht I've googled, the first arg should be a char* right? It's giving me a seg fault, and not knowing what fread is, I am having a hard time fixing it. Here's the code:
thanks!
don't panic, I'm mostly harmless
Sarah
Code:
int lines = 32507;
unsigned short int *prec;
int x=0;
char *file = "data_31.3125_-108.6875";
FILE *fp = fopen(file, "r");
for (x=0;x<lines/4;x++) {
if(fread(&prec[x],sizeof(unsigned short int),1,fp) != 1)
printf("read prec[x] err rec %d %s\n", x, file);
//etc.
thanks!
don't panic, I'm mostly harmless
Sarah