Get cursor position in element C

I am reading a file with fgetc, so every time it reads a character, the positio cursor changes.

Is it possible, after each reading, to find out the "coordinates" of the cursor on the file in terms of column and row numbers?

thank

+3
source share
2 answers

You can use ftell

It does not give you a position in terms of row and column, but from the very beginning gives you the current position in the stream.

+7
source

"", . , . , "", . , "row" "column":

  • . , . , - Unix Windows.
  • . . , , , "" "", "" " " 0.

  • ( ftell) .
  • , , , . "", "".

- , , - , . , , , -, .

+5

Source: https://habr.com/ru/post/1726579/


All Articles