So what you're trying to learn is how to read the number in from a file, am I right? If so, this tutorial should help you out a lot (it helped me when I was still learning file I/O): http://www.cplusplus.com/doc/tutorial/files/
Also, something looks a little bit awkward about your reversing algorithm if that's what it is...