Code:
do
{
ReadValue (inFA, A, successA); //Read the value of file A.
if(successA)
{
ReadValue (inFB, B, successB); //Read the value of file B if the first was successfully read.
if(successB)
{
//I WANT TO LOOP HERE.
if(A < B) //Check if the value of file A read is greater than the value of file B.
{
WriteValue (outF, A); //Write the value of file A if smaller than that of file B.
ReadValue (inFA, A, successA); //Read next value in file A.
}
else
{
WriteValue (outF, B); //Write the value of file B if smaller than that of file A.
ReadValue (inFB, B, successB); //Read next value in file B.
}
//END LOOP HERE IF ONE OF THE SUCCESSES FAILS.
}
else
{
WriteValue (outF, A); //If nothing in file B is read, print only file A's value.
}
}
else
{
ReadValue (inFB, B, successB);
if(successB)
{
WriteValue(outF, B);
}
}
}while (successA || successB);
Problem here: If I place a while loop containing (successA && success B) in the area I want to place a loop in, I get an infinite loop. But it shouldn't do that if one of the functions eventually fails reading a value... right?
Bookmarks