Why can't I call read() twice on an open file?

后端 未结 7 1544
挽巷
挽巷 2020-11-21 05:05

For an exercise I\'m doing, I\'m trying to read the contents of a given file twice using the read() method. Strangely, when I call it the second time, it doesn\

7条回答
  •  渐次进展
    2020-11-21 05:25

    The read pointer moves to after the last read byte/character. Use the seek() method to rewind the read pointer to the beginning.

提交回复
热议问题