qfile

Why can't QFile read from the "~" directory?

I've tried the following short example to find out about a bug in a bigger program I am working on. It looks like QFile doesn't support unix (or the shell's) notation for the home directory: #include <QFile> #include <QDebug> int main() { QFile f("~/.vimrc"); if (f.open(QIODevice::ReadOnly)) { qD...

How to create a new File in Qt

Hello friends, I am a Qt beginner and just got stuck with the problem. I am looking for a file SomePath/NewDirectoryA/NewFile.kml ( NewFile.kml will be the only file in NewDirectoryA, having this directory just to maintain semantics in the project ). If SomePath/NewDirectoryA/NewFile.kml exists then I will use it in my code and If it d...

QFile/QDataStream writing on existing data

Hello, I have got a file which is let's say 8 bytes length. For example it looks like that: 22222222 Now, I read first let's say 5 bytes and changing them. For ex. to 11111 Finally, I want to write them ONTO EXCISTING DATA to the file, so I expect the file to look like that: 11111222 But I get only 11111, because file is erased. Ho...

QFile open file for writing fails

I'm trying to open file and write some text data into it. QFile out(":/test.txt"); if (!out.open(QIODevice::ReadWrite)) { QMessageBox msgBox; msgBox.setText(out.errorString()); msgBox.exec(); return; } But it fails with "Unknown error". (Qt 4.6, Wnidows XP SP3) ...

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 a shared drive. Btw, this path is a valid one on Windows and is generat...