Reading file character-by-character and comparing those characters in C
<p>I've got a little program that reads through a text file character-by-character and checks if the file contains certain values.</p>

<p>If it finds the letter A next to another letter I want the file to push the second letter to a new line and print the result. For example, if I had the following text file:</p>

<p>ABABAAAB</p>

<p>The printed result would be: </p>

<pre><code>A
B
A
B
A
A
A
B
</code></pre>

<p>Would I need to store the current character being read in a variable say called "prevChar" then record the next character in a variable called "currentChar" then compare them and print the result? Keep doing this for every character? </p>