[Qt-interest] Writing a file with QtScript

Nathan Carter nathancarter5 at gmail.com
Tue Jun 2 22:58:22 CEST 2009


On May 29, 2009, at 3:26 AM, skerit at kipdola.com wrote:

> Hi everyone,
>
> I'm converting a few old ruby scripts to Amarok2 at the moment, but
> I'm having a few problems I can't find the answer to in the
> documentation.
>
> I want to download an XML file and store it locally. Getting the XML
> is no problem, but I have no idea how to store it!
>
> I've been playing with Qfile for a while. I can *make* the file, I
> just have no idea how to save anything in it.
>
> ui = new QFile ("zjever.txt" );
> ui.open( QIODevice.ReadWrite );
> var line = new QTextStream(ui);
> ui.close();
>
> Greetings,
> Jelle De Loecker

Are you asking because the stream operators aren't available in  
script, and they seem to be the only ways of writing to a  
QTextStream?  You don't have to use a QTextStream, you know.  QFile  
inherits QIODevice, which provides write() methods.

Nathan



More information about the Qt-interest-old mailing list