void megaadmin()
{
system("cls");
cout<<"this console is only for registering new admins";
cout<<"please enter the required username";
string temporary_string;
cin>>temporary_string;
ofstream f("admin_details.txt",ios::out|ios::app);
f<<temporary_string;
cout<<"please enter the password";
cin>>temporary_string;
f<<temporary_string;
cout<<"would u like to enter more usernames and passwords if yes enter 1 eles 2";
int n;
cin>>n;
if(n==1)
megaadmin();
else
exit(0);
}
admin_details.txtが作成したばかりですが、私が入ったユーザ名とパスワードの情報は、特定のテキストファイルofstreamの: - テキストファイルに出力しないファイルが作成されつつあるものの
に格納なっていません
*ファイルの内容を*と*どのように*チェックしますか?おそらく、チェックする前にバッファをフラッシュするべきでしょうか? –
また、(あなたの問題とは関係ありません)、私はあなたが表示するコードで再帰の代わりに*ループ*を使用することをお勧めします。 –
また関係ありません: 'ofstream'に' ios :: out'を指定する必要はありません。 – molbdnilo