Results 1 to 4 of 4

Thread: Problem in reading xml in win7

  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 Problem in reading xml in win7

    In my project i try to open an xml from my current directory. I works perfectly in win xp and some versions of win7.
    But in win7 ultimate it does not open the xml. why is it. The same build works in win xp. Is there any plugin needed to be installed in win7 ?? how can i rectify this issue

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in reading xml in win7

    This is unrelated to Qt. Most likely you don't have permissions to the file or the file doesn't exist. It could simply be that the current working directory is different. Do you check that the file exists before trying to access it?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Default Re: Problem in reading xml in win7

    on the first run we create the file in the current directory. I in some version of win7 the xml is not created.
    Qt Code:
    1. void mainwindow::checkscoreboardfile()
    2. {
    3.  
    4. dir=new QDir(dir->currentPath());
    5. QFile file(dir->filePath("Score.xml"));
    6. if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
    7. {
    8. if (file.open(QIODevice::WriteOnly))
    9. {
    10. QXmlStreamWriter* xmlWriter = new QXmlStreamWriter();
    11. xmlWriter->setDevice(&file);
    12. xmlWriter->writeStartElement("Score");
    13. xmlWriter->writeEndElement();
    14. file.close();
    15. }
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem in reading xml in win7

    Test what the current directory is. You probably don't have permissions to create files there.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Problem with compiling MySQL Plugin (Win7 x64)
    By GwynBleidD in forum Installation and Deployment
    Replies: 3
    Last Post: 24th April 2011, 11:13
  2. RSS, problem reading XML.
    By Archa4 in forum Newbie
    Replies: 0
    Last Post: 4th February 2011, 10:41
  3. LibQxt won't build with Qt 4.7.0 on Win7
    By qratman in forum Installation and Deployment
    Replies: 1
    Last Post: 14th October 2010, 14:09
  4. Problem with reading from file
    By iamjayanth in forum Qt Programming
    Replies: 15
    Last Post: 23rd April 2009, 13:12
  5. Problem with reading a file
    By Buhmann in forum Qt Programming
    Replies: 11
    Last Post: 17th February 2006, 13:02

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.