How To Use Files In Code?

My question is, if I had a program that would, lets say, shuffle through a provided .txt file and count the number of times the word "I" showed up. How would I use that program for the .txt file I want to implement it on? What code would allow me to get a file from my computer, and then moreover make sure that the code is used on this given file?

I've searched around but I'd only find weird code that I couldn't really understand, hoping someone here can better assist. Thanks!
fstream is all about reading/writing files ...
http://www.cplusplus.com/reference/fstream/fstream/is_open/

by default, you could use the arguments given by main():
https://stackoverflow.com/questions/3024197/what-does-int-argc-char-argv-mean

when you drop a .txt on the .exe you`ve created, argv[] will contain the path to that .txt file on your system. just use fstream to do your stuff with that .txt file ...
Thanks John87Connor for showing me fstream! I've yet been able to really understand what those parameters are inside int main(..), but fstream works fine for what I have in mind if I'm thinking this correctly. I'll look more into it. Thanks again!
Topic archived. No new replies allowed.