2016-12-16 9 views

答えて

0

fstream file_name; 
string user_input_file; 
vector<vector<string>>read_in_vector; 

file_name.open(user_input_file.c_str()); 

cout << "You have entered:" << endl; 
     cout << "Row Desc: " << add_row << endl; 
     cout << "Username: " << add_username << endl; 
     cout << "Password: " << add_password << endl; 
     cout << "Notes: " << add_notes << endl << endl; 
vector<string>temp = { add_row,add_username,add_password,add_notes }; 

がどのように私は、データ・ファイルの既存の部分を消去することなく、データ・ファイルに一時 と呼ばれるベクトルの要素を追加し、ファイルの末尾に追加することができます/ stream/buffer /何でも、これを正しく読んでいれば、あなたが望むものだと思います。使用法:

file_name << temp[0]; 

これは残りの内容を変更せずにテキストを安全にファイルに追加します。

関連する問題