Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C++: Odd error

Options
  • 12-01-2008 7:28pm
    #1
    Closed Accounts Posts: 2,349 ✭✭✭


    I'm trying to open a cached file, read its contents, close it, then delete it.

    First I use:
    RetrieveUrlCacheEntryStream()
    then ReadUrlCacheEntryStream()

    and the buffer contains the cached file. So I'm all good up to there.

    Then I do:
    UnlockUrlCacheEntryStream() on the handle, which returns true
    and finally DeleteUrlCacheEntry() to get rid of the file.
    DeleteUrlCacheEntry fails and returns the following error through GetLastError():

    ERROR_SHARING_VIOLATION
    "The process cannot access the file because it is being used by another process."

    There are no browser windows opened. This error is not even given as a possible error in the DeleteUrlCacheEntry() MSDN page.

    Any help very much appreciated.

    See here for reference:
    http://msdn2.microsoft.com/en-us/library/aa383928(VS.85).aspx


Comments

  • Closed Accounts Posts: 1,444 ✭✭✭Cantab.


    Haven't used C++ in a while. Just a thought, but when you write this file to cache, do you close the writer stream before attempting a read?


  • Closed Accounts Posts: 7,563 ✭✭✭leeroybrown


    Could you be tripping over an external influence like anti-virus/anti-spyware software doing real time scanning?


  • Closed Accounts Posts: 2,349 ✭✭✭nobodythere


    Sorted it. Was looking at the windows system error codes instead of the wininet.lib error codes.

    Thanks all


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,086 Mod ✭✭✭✭Tar.Aldarion


    Are you around the main college? I need help with C++ :)


  • Closed Accounts Posts: 2,349 ✭✭✭nobodythere


    I will be in an hour if you want but I dunno how useful I am to you! I'll pm you my number, I don't spend all day on boards you know! Hooray something to do.

    Also, this problem isn't solved, I thought that'd fix it but it didn't. IE wrote the file to the cache, not me. I'm thinking that's why I can't delete it? It's IE7

    There is no AV/firewall running.


  • Advertisement
  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,086 Mod ✭✭✭✭Tar.Aldarion


    What compiler do you use? I think I just need to change mine from vc++ express 2005 as windows.h is not included with this.


Advertisement