FindClose doesn't. . .

This is a discussion on FindClose doesn't. . . within the Windows Programming forums, part of the Platform Specific Boards category; I have a recursive function that pulls in a large amount of data to a local store. The data comes ...

  1. #1
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065

    FindClose doesn't. . .

    I have a recursive function that pulls in a large amount of data to a local store. The data comes in just fine and is displayed in my app. The problem is that I have added an upgrade function to my code that renames the data directory then imports the directory again (thus changing the data to the newly formatted data). No problems here either. I then attempt to remove the temp directory that I originally renamed. In comes the problem: I can delete all nodes and branches EXCEPT for the very deepest level on the last top-level subdirectory that is imported. All files within the directory are removed, however, the directory reports (when I pause operations just before the delete and attempt to remove it manually) that the directory is still in use.

    I transverse the directories the same way in the import function as I do in my removedir function. Basically, I read all the files in and, if it is a directory, I recurse down a level and process that directory before popping back out.

    I have added debugging messages in the form of MessageBox's into my code that shows me that the directory is being released via FindClose. Also, find close does not report an error.

    What am I missing here?

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    You could use a tool called Unlocker to see if there's any handle left open on the directory. IF there is, you can't delete it. You could find out if it's your own app or something else causing it- Hopefully anyway.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by Elysia View Post
    IF there is, you can't delete it.
    I know there is. . .
    Quote Originally Posted by Elysia View Post
    You could find out if it's your own app or something else causing it- Hopefully anyway.
    Likewise, I know it is me, but the thing I cannot figure out is WHY is it me when I call FindClose.

    Any ideas?

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    Using C++ or C?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    C. . . but, uh, nevermind. . .

    Of course FindClose works perfectly, just as you expect. . .

    Also, another function that works perfectly is SetCurrentDirectory. . . oddly enough, if you attempt to rmdir a directory that is the "CurrentDirectory", you cannot.

    Oops.

    Thanks for the help.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21