2012-05-04 26 views
0

Qt:パスで必要なディレクトリを持つファイルを作成する方法は?存在しない場合は "./gg/ggg./fff/ff/file.dd"を作成しますか?あなたはQt:ファイルを作成するにはどうすればいいですか?

QDir directory("gg/ggg./fff/ff/file"); 

としてパスを設定することができます

+4

可能重複[再帰的にQtの中にディレクトリを作成するには?](http://stackoverflow.com/questions/6232631/how-to-recursively-create-a-directory-in- qt) – karlphillip

答えて

3

あなたは

QDir().mkdir("MyFolder"); 


bool QDir::mkdir (const QString & dirName) const 
Creates a sub-directory called dirName. 

Returns true on success; otherwise returns false. 

See also rmdir(). 

のようなフォルダを作成することができますhttp://doc.qt.io/qt-5/qdir.html#mkpath

0123を参照してください http://doc.qt.io/qt-5/qdir.html#mkdir

bool QDir::mkpath (const QString & dirPath) const 
Creates the directory path dirPath. 

The function will create all parent directories necessary to create the directory. 

Returns true if successful; otherwise returns false. 

を参照してください。

http://doc.qt.io/qt-5/qfile.html#openを参照してください

関連する問題