File i/o

i have an assignment where i need to read from a file and print certain things back i can do the check to get out what i need from the string but i dont know how to get the information from a file or how to write to a file any help would be appreciated
 
#include <fstream> 


Include fsteam for file i/o schtuffs

use something like

 
ifstream myfile("myfileinappdirectory.txt", ios::in);


along with
 
myfile.getline();


don't forget to output whatever you store your getline to.

usage of
 
myfile.close();

is also highly reccommended. Considering this is an assignment I'm not going to do your work for you, but hopefully this will point you in the right direction as far as syntax goes. ^_^
Topic archived. No new replies allowed.