Hello! There is a type file:

00000 11100 00000 

How best to count from this file only a piece? For example only:

 1110 0000 

I need to handle large files, and the desired piece can be anywhere. How to do it?

  • How do you determine where the piece is located? Is there a ready offset or line number? Or maybe you read in sequence and determine what it is. - KoVadim 4:34 pm
  • There are variables x and y. Looking for them and looking for a piece - user26699
  • one
    @egordorichev, is the length of the lines fixed? - dzhioev
  • Not. The file constantly changes its size, but the coordinates still remain known - user26699

1 answer 1

fseek This is the function that you can use when reading a file.

  • Is there a function to move the pointer down for some number of lines? - user26699
  • You yourself can easily write it using only fgetc() and counting the number \n . - avp
  • No, this is not. @avp correctly wrote, you can implement it yourself, looked through all the characters of the newline and wrote their indices into an array. Thus, substituting the values ​​from this array in fseek, you can move to the desired line. - iksuy