Results 1 to 12 of 12

Thread: QTemporaryFile problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QTemporaryFile problems

    Don't worry, I deleted it.
    Starting detached means that the process won't be a child of your process, therefore you won't be able to monitor its events (like exit). Indeed it starts as a daemon, but that doesn;t mean you can delete the binary.

    As for startDetached returning false, maybe you don;'t have the right permissions set on the temp file. See QFile::setPermissions.

  2. #2
    Join Date
    Jan 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTemporaryFile problems

    Thanks
    Okay, i'm using this code now:
    Qt Code:
    1. if ( size != -1 )
    2. {
    3. qDebug() << "wrote " << size << " into the file";
    4. QFile file ( tmpFile->fileName() );
    5. tmpFile->close();
    6. if ( file.open( QIODevice::ReadOnly ) && file.exists() )
    7. {
    8. qDebug() << file.fileName();
    9. file.setPermissions ( QFile::ReadOwner | QFile::WriteOwner |
    10. QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther );
    11. qDebug() << QProcess::startDetached ( file.fileName() );
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 
    you see, i've set the permissions to execute for everyone, but it still gives a false
    €dit: even if i close the file before launching. strange
    Last edited by C167; 21st June 2008 at 16:08.

  3. #3
    Join Date
    Jan 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTemporaryFile problems

    any ideas? on windows, its the same problem and the program must be finished by tomorrow (need some time to test it etc.)

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QTemporaryFile problems

    why don't you manually check the temporary file? put a break point before startDetached and go where the temp file is. try to execute it in a terminal and see what happens.

  5. #5
    Join Date
    Jan 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTemporaryFile problems

    gdb tells me that the file i want to load does not exist, even if i use kdevelop to debug (which is not able to start the program)

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QTemporaryFile problems

    probably the file already got deleted.
    I meant trying to manually execute the temporary program. just open a console, go to the location where the temp file was created and try to open it.

    I suggested the breakpoint before startDetached because that would prevent the file from being deleted.

  7. #7
    Join Date
    Jan 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTemporaryFile problems

    sorry, i meant the file where ther startDetached is, i cannot load the cpp file. I now simply make a QFile::copy to copy it to another filename

    Hm... seems that i broke something in the database that contains the blobs, but older, not deleted version work, they start konsole, xterm or wine
    €dit: oh wait, the konsole doesn't start, i get no output, but it is a valid binary according to file
    Last edited by C167; 22nd June 2008 at 11:02.

Similar Threads

  1. flicker and wierd resize problems ...
    By momesana in forum Qt Programming
    Replies: 1
    Last Post: 12th May 2008, 19:00
  2. Problems compiling hello world with edyuk
    By mck182 in forum Newbie
    Replies: 1
    Last Post: 7th May 2008, 17:45
  3. Replies: 2
    Last Post: 8th March 2007, 23:22
  4. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 16:39
  5. problems with Opengl
    By SlawQ in forum Qt Programming
    Replies: 4
    Last Post: 12th February 2006, 23:49

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.