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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -