문제

So I stored a struct to a sequential file in this format "%d %s %s %f" what I am wondering is , if I am seeking the last record from a file , and I use fseek(*val,offset*-1,Seek_end when i use fscanf would it read backwards? So I would have to read "%f %s %s %d"?

도움이 되었습니까?

해결책

No, it doesn't cause subsequent reads to go backwards, reads always go forwards.

All it does is sets the file pointer to that distance from the end of file. So, if you have a file containing the English letters and you seek with -5 and SEEK_END, the next reads will give you vwxyz in that order.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top