Put your code in code tags, see faq on how to do this. (pls edit your post so ppl have an easier job reading your code).

You dont really state what the problem is, do you expect someone to code up the desired function?
You already know that you can use ifstream to open a file. So do that. Or explain what exactly it is, you have problems with.