Using fseek to backtrack

前端 未结 5 921
轻奢々
轻奢々 2020-12-11 19:18

Is using fseek to backtrack character fscanf operations reliable?

Like for example if I have just fscanf-ed 10 characters but

5条回答
  •  轮回少年
    2020-12-11 19:47

    Fseek has no understanding of the file's contents and just moves the filepointer 10 characters back.

    fscanf depending on the OS, may interpret newlines differently; it may even be so that fscanf will insert the ^M if you're on DOS and the ^M does not appear in the file. Check your manual that came with your C compiler

提交回复
热议问题