Thread: Strange behavior of SHFileOperation between my debug and release version

  1. #1
    Registered User
    Join Date
    Mar 2004

    Strange behavior of SHFileOperation between my debug and release version

    here's a snippet of my code
    what i intented to do was to delete the whole directory "C:\\WINDOWS\\Desktop\\Game", and then restore the directory from "C:\\backup\\game" so that my desktop "game" directory isnt too messy.
    SHFILEOPSTRUCT file_struct;
    ZeroMemory(&file_struct, sizeof(file_struct));
    game_dir = "C:\\WINDOWS\\Desktop\\Game";
    game_dir_org =  "C:\\backup\\game" ;
    file_struct.wFunc = FO_DELETE;
    file_struct.pFrom = game_dir ; // deletes the "game" dir on  desktop
    int iz = SHFileOperation(&file_struct);
    file_struct.wFunc = FO_COPY;
    file_struct.pFrom = game_dir_org;
    file_struct.pTo = game_dir;
    what happens is that the debug version deletes "C:\\WINDOWS\\Desktop\\Game" as it should while the release version does not.
    also, sometimes the release version deletes "C:\\backup\\game" while no problems with debug version
    what's wrong??

    - win98se
    - vc++ 6.0
    - API style

  2. #2
    Registered User
    Join Date
    Oct 2001
    How are game_dir and game_dir_org declared?

  3. #3
    Join Date
    Jan 2002
    Make sure you are double NULL terminating game_dir_org and game_dir as stated in the descriptions for the pFrom and pTo members of SHFILEOPSTRUCT (and as implied by Swoopy).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug release conf problem
    By fighter92 in forum Game Programming
    Replies: 6
    Last Post: 03-20-2009, 04:39 PM
  2. dumpbin with debug and release version
    By George2 in forum C Programming
    Replies: 5
    Last Post: 11-12-2007, 03:10 AM
  3. makefiles - debug & release?
    By cpjust in forum C Programming
    Replies: 6
    Last Post: 10-26-2007, 04:00 PM
  4. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 11:08 AM
  5. Why does this crash in release version but not debug?
    By Dual-Catfish in forum C++ Programming
    Replies: 1
    Last Post: 04-03-2002, 06:19 PM