How to move back to the starting of previous line after reading a line using fgets()?
<p>For example if the file contains:</p>

<pre><code>12345
-3445654
1245646
</code></pre>

<p>I want to read the first line into a string using <code>fgets()</code>. Then I want to read the second line in too check if there is a <code>'-'</code> in the first spot. If there is one, I will read the second line and <code>strcat</code> it to the first line. </p>

<p>Then I want to read the thrid line using <code>fgets()</code> again. This time when there is no <code>'-'</code> I just want to make the file go back to the beginning of the third line so that the next time I call <code>fgets()</code> it will read the same third line again. </p>

<p>Is there a way I can do this?</p>