Your basic flaw is that you take evrything, name and grades, as characters. For the names this will not give you any trouble but for the grades it will only get you the first out of two possible numbers. The best option would therefor be to have two character variables BufferOne, BufferTwo. You then, for the name, get into BufferOne and output that variable into the next file till you get to the grades. Once at the grades you get one value into BufferOne then you get one into BufferTwo, you then check if BufferTwo is a space. If it is a space you do the following:

Code:
sum = sum + (int)BufferOne;
if it is not a space we can assume it is the second digit of the number so the following code would apply:

Code:
sum = sum + ((int)BufferOne) * 10) + (int)BufferTwo;
you would then eat the space using a get(BufferOne) and start over again getting the first number into BufferOne. THis method would involve quite a lof of if statements and some looping.