Results 1 to 19 of 19

Thread: xstrm.read();

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: xstrm.read();

    Quote Originally Posted by mickey
    yes it was the error; but if I use .read() my app doesn't respond....
    I coded this also:
    Qt Code:
    1. QFile f(file);
    2. f.open(IO_ReadOnly | IO_WriteOnly);
    3. QTextStream xstrm(&f);
    4. QDomElement tag1 = doc.createElement ("PLAIN"); // SEE THIS!!!!
    5. Class.Write(QTextStream(&f));
    6. QString plainText = xstrm.readLine(); // or .read()
    7. QDomText t1 = doc.createTextNode(plainText);
    8. //QDomText t1 = doc.createTextNode("hello"); //with this ok
    9. tag1.appendChild(t1);
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. void Class::Write(QTextStream &xstrm) {
    2. xstrm << "hello\n";
    3. }
    To copy to clipboard, switch view to plain text mode 
    after this in my file I found:
    Qt Code:
    1. hello
    2. a line of ascii code
    To copy to clipboard, switch view to plain text mode 
    like above I'm trying to create a file; in that I like put "hello" with class.XML (this work); then I like put the contentent of file (in this case "hello") inside two tag <Plain> </plain>;
    that doesn't work (but it works using
    Qt Code:
    1. QDomText t1 = doc.createTextNode("hello");
    To copy to clipboard, switch view to plain text mode 

    other thing: using f.open(IO_ReadOnly | IO_WriteOnly); when I save file the text is append at the end...why? with only IO_WriteOnly the file is destroyed everytime (I want this)...thanks

    then I need put the
    Qt Code:
    1. QDomElement tag1 = doc.createElement ("PLAIN");
    2. Class.Write(QTextStream(&f));
    3. QDomText t1 = doc.createTextNode(..............);
    To copy to clipboard, switch view to plain text mode 
    content of strm between tag PLAIN. How this?
    Last edited by mickey; 3rd July 2006 at 18:36.
    Regards

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.