This might help you to progress:
It seems you read only one character before the while loop. You might want to read characters continuously inside the while loop and stop looping when end of file is reached.
Second hint:
You leave the file open. What should you do before exiting your program?