ファイルに内容を入力したいのですが、作成したい名前のファイルが存在するか確認したいです。もしそうなら、たとえファイルが空であっても、私はファイルを作成したくありません。
私の試み
bool CreateFile(char name[], char content[]){
std::ofstream file(name);
if(file){
std::cout << "This account already exists" << std::endl;
return false;
}
file << content;
file.close();
return true;
}
私がやりたいことをする方法はありますか?