The QDataStream allows you to serialize some of the Qt data types. For QString, char pointer is right. These are my example:
First is used to write a QString into a file:
out << "Hello World!";
QFile file("file.dat");
file.open(QIODevice::WriteOnly);
QDataStream out(&file);
out << "Hello World!";
To copy to clipboard, switch view to plain text mode
Second is used to read content from a file:
char *ch;
in >> ch;
char *ch;
QFile file("file.dat");
file.open(QIODevice::ReadOnly);
QDataStream in(&file);
in >> ch;
QString str(ch);
To copy to clipboard, switch view to plain text mode
The "str" is your result!
Bookmarks