Neither fread nor fseek in my code advance the cursor position the file, whether I opened it as r or r+, and I (obviously) require the cursor to change to read past the first few bytes.
the 2s in fseek and fread are actually from another variable, but I substituted here for readability.Code:FILE* values; fopen_s(&values,"values.txt","rb"); char bytes_read[2][4]; for(int min=0;min<2;++min) { // read the bytes for the maximum value of the hack fread(bytes_read[min],2,1,values); // advance the file fseek(values,2,SEEK_CUR); }
This code doesn't work for me.
Any help?
Edit: Nevermind. The file I was attempting to read consisted of: 27 0F 00 01 27 0F 00 01 ... so when I read two bytes I got 27 0F.. then it advanced the buffer by 2.. however, the fseek advanced the buffer by an EXTRA 2, which brought me to the next 27 0F. sorry



LinkBack URL
About LinkBacks


