したがってboost::filesystem::path Base
、フォルダーが存在しない場合はフォルダーを作成し、文字列からバイナリファイルを作成するベースがあります。現在、私は次のような機能を持っています:
void file_service::save_string_into_file( std::string contents, std::string name )
{
std::ofstream datFile;
name = "./basePath/extraPath/" + name;
datFile.open(name.c_str(), std::ofstream::binary | std::ofstream::trunc | std::ofstream::out );
datFile.write(contents.c_str(), contents.length());
datFile.close();
}
ディレクトリから存在する必要があります。では、目的の機能を実現するために、関数を boost.filesystem API に更新する方法を知りたいですか?