I faced with an issue to move my cursor to the beginning of the line. I can’t find any suitable solution except using pread(IO, Location, N) with N window where
read N bytes
check if there is a \n and repeat until reach \n increasing pread(file, offset - [i * N], N)
I am reading from the file on the file system.
By cursor I mean seeking/offset/caret/pointer/position/location in the opened file when you move your position by N bytes and read starting from this point.
I am writing a parser to parse some custom file format.