c++ - reading a line from a file and put it in a string (with fstream) -
i want read file , put each line in string (each line contains single word) i've used getline
doesn't work neither >>
command. here's code: (i'm using visual studio)
string device_kind; ifstream bank_info; bank_info.open ("acquirer.info"); bank_info >> device_kind; //fails compile getline (bank_info, device_kind); //also fails bank_info.close();
use bank_info.geline(device_kind,size)
getline member function of ifstream use . operator.
Comments
Post a Comment