Reputation: 7459
I have XML data
stored in QString/QByteArray
, I want to write that xml data in new sample.xml
file and save that file in device document directory.
Anyone please guide me on this.
Thanks in advance.
Upvotes: 1
Views: 353
Reputation: 35044
QFile file(QDir::currentPath() + "/shared/documents/yourfile.txt");
if (file.open(QIODevice::WriteOnly)) {
QTextStream stream(&file);
stream << "DATA HERE \n";
}
Upvotes: 0
Reputation: 53173
You can use QXmlStreamWriter. Here you can find an official example which reads from a device and then writes that out. You could slightly modify this to allow to read from your QString/QByteArray by the appropriate construct if I understand your query correctly.
Upvotes: 1