开发者

QFile open file on a shared drive

I have the following:

Q_ASSERT(QFile::exists("\\.host\Shared Folders\username On My Mac\Desktop\New Deck.txt"));

The file is picked from QFileDialog but when check if it exists with QFile::exists it returns FALSE;

Is there any reason why QT cannot open a file on开发者_如何学Python a shared drive.

Btw, this path is a valid one on Windows and is generated by putting the "New Deck.txt" file on my Mac OSX desktop and tried to be read from a QT application run from VM Ware Windows XP SP2.


You must escape \ in the string literal via \: "\\.host\Shared Folders\..." Also, unless this is for your debugging only, asserting on the existing of files is a bad idea. The file could always disappear between selecting it in the file dialog and opening it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜