I cannot see a problem here:
getRdata() completes, the fault is on the return to main -- "Cannot access memory at address" of byte.Code:vector<bmHit> cur; uchar byte = getRdata(rf,cur); /* segfault */ uchar getRdata(FILE *fs, vector<bmHit> &data) { uchar byte; char buf[128] = {0}; bmHit cur; if (!fscanf(fs, "BYTE %d%*c", (int*)&byte)) return 0; fgets(buf,128,fs); while (strncmp(buf,"BYTE",4)) { sscanf(buf, "%d:%d:%d", &cur.doff,&cur.goff,&cur.len); data.push_back(cur); fgets(buf,128,fs); } fseek(fs,-(strlen(buf)),SEEK_CUR); return byte; }



LinkBack URL
About LinkBacks





it is just a plain text file. I'm grabbing the value 101 from, eg: "BYTE 101" and putting it into an unsigned char.