Results 1 to 2 of 2

Thread: Xml parse not working in windows 7

  1. #1
    Join Date
    Jul 2011
    Posts
    81
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default Xml parse not working in windows 7

    Qt Code:
    1. Xmlwrite()
    2. {
    3. for(i=0;i<ranking;i++)
    4. {
    5. rank.insertMulti("rank",rankget[i]);
    6. name.insertMulti("name",namget[i]);
    7. time.insertMulti("time",timeget[i]);
    8. }
    9. dir=new QDir(dir->currentPath());
    10. QFile* file;
    11. file=new QFile(dir->filePath("Score.xml"));
    12. if (file->open(QIODevice::WriteOnly))
    13. {
    14. QXmlStreamWriter* xmlWriter = new QXmlStreamWriter();
    15. xmlWriter->setDevice(file);
    16. xmlWriter->writeStartElement("Score");
    17. QMapIterator<QString, QString> i(rank);
    18. QMapIterator<QString, QString> j(name);
    19. QMapIterator<QString, QString> k(time);
    20. while (i.hasNext() && j.hasNext() && k.hasNext())
    21. {
    22. i.next();
    23. j.next();
    24. k.next();
    25. xmlWriter->writeStartElement("Player");
    26. xmlWriter->writeAttribute(i.key(), i.value());
    27. xmlWriter->writeAttribute(j.key(), j.value());
    28. xmlWriter->writeAttribute(k.key(), k.value());
    29. xmlWriter->writeEndElement();
    30. }
    31. xmlWriter->writeEndElement();
    32. file->close();
    33. }
    34. }
    To copy to clipboard, switch view to plain text mode 


    The above function create an xml file on the installed folder. it works prefectly in windows xp. But in Windows7 i can't access the xml file

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Xml parse not working in windows 7

    What is your current path? Windows 7 blocks attempts to write to protected directories, e.g. anything under "C:\Program Files".

    Edit: It blocks applications with a manifest, and redirects writes of applications without manifests.
    Last edited by ChrisW67; 12th September 2011 at 07:09. Reason: updated contents

Similar Threads

  1. Does anyone actually have Phonon working on Windows?
    By pssss in forum Qt Programming
    Replies: 7
    Last Post: 18th March 2011, 18:51
  2. QTabWidget QSS transparency not working under Windows
    By il_gatto in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2011, 12:02
  3. Getting Phonon working on windows XP
    By keshava in forum Installation and Deployment
    Replies: 0
    Last Post: 12th May 2009, 16:37
  4. Windows fonts not working in QT?
    By frenetic in forum Installation and Deployment
    Replies: 2
    Last Post: 10th January 2009, 02:17

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.