title: Seek to line number in text file using C
body: <p>I have an ASCII binary file which looks something like:</p>
  
  <pre><code>00010110001001000110011001000111
  01011000011100001010100001001000
  11110001011010000010010101111010
  00000000000000000000000000000000
  01011010101000010001010101110000
  </code></pre>
  
  <p>Each line has 32 characters (so it is of length 33 with <code>\n</code>). I am trying to seek my file pointer to the line that comes right after the <code>0x0</code> line (the 4th line in the above example).</p>
  
  <p>What I did was as follows. First, I counted how many lines are in the file. So <code>5</code> in this case. I also kept an index at the line which holds the <code>0x0</code> line. So <code>4</code> in this case. I multiplied <code>4</code> by <code>33</code> which returns which character the first number after the <code>0x0</code> is (I have to add a 1 since this actually returns the <code>\n</code> at the end of the <code>0x0</code> line. </p>
  
  <p>After that, I just used <code>fseek</code>. However, it is not working. What is wrong here? Here is my code:</p>
  
  <pre><code>int bytes = 33 * c;
  fseek(fp, bytes+1, SEEK_SET);
  char test[34];
  printf("HERE: '%s'", fgets(test, 34, fp));
  </code></pre>
  
  <p>Thanks!</p>