Results 1 to 5 of 5

Thread: how to delete a file?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Kranj, Slovenia
    Posts
    34
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to delete a file?

    Hi!

    I am downloading several files from the Internet using http->get(). Sometimes I get empty file (either because of a server timeout, wrong URL, port blocking, strange rewrite rules on the server,...). When I close the application I set to delete all the downloaded files and remove the dir. where I saved them. But those files with zero size can not be deleted. It seems they are not closed. How can I close them? Simple file.close() does not work.

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to delete a file?

    Are you sure that they are empty and not placeholders for files that your application still is trying to fetch?

  3. #3
    Join Date
    Jan 2006
    Location
    Kranj, Slovenia
    Posts
    34
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to delete a file?

    I do not know. The program is definitely trying to fill them, since they are open. Since the http->get() in those cases failed they are not closed and I can not delete them. Is there anything I can do?
    Regards,
    Luka

  4. #4
    Join Date
    Aug 2006
    Location
    banglore
    Posts
    21
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: how to delete a file?

    R u downloading one file at a time? If so, before start downloading next file, check the previous download whether its failed or timeout, then close your file... Then will start download the next one...


    Thanks,
    Mani

  5. #5
    Join Date
    Jan 2006
    Location
    Kranj, Slovenia
    Posts
    34
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to delete a file?

    It should download only one file at the time but the request for new file are sent after the header is received, therefore it is possible to download several files at the same time... If the file is received successfully then the file is closed, but if it fails it stays open... I was hoping there is some way to close or abort writing to it in some way. If somebody has an idea that would be great! Otherwise thanks to all that replied!

    Regards,
    Luka

Similar Threads

  1. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 11:47
  2. How to delete File
    By rajesh in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2006, 11:23
  3. c++, placement delete upon exception
    By stinos in forum General Programming
    Replies: 6
    Last Post: 31st October 2006, 15:38
  4. SQLite-DB in a qrc file
    By Lykurg in forum Qt Programming
    Replies: 5
    Last Post: 31st July 2006, 19:24
  5. QHttp GET File & Password
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 11th June 2006, 13:04

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.