Prev: How to check whether received page is from cache or fresh page
Next: How to get function Name against function address of vtable?
From: Woody on 12 Mar 2010 04:15 My app, written in C++ (Visual Studio 2005) fails to delete a file, yet gives no error. This is occurring with the C runtime library function 'remove(path)'. // create file using fopen(path,"wb+") and write to it // close file err=remove(path); // err is always 0, meaning successful removal // If I set a breakpoint here with the debugger, Windows Explorer verifies the file has been removed fopen(path,"wb+"); // open the file, which should now no longer exist If I do not pause at the breakpoint, the file is created by the second fopen, but its creation date/time is that of the existing file. This is true even for files that existed when the app was started (i e, hadn't been created by this run of the app). In both cases, it is a debug build. If I put a pause between 'remove' and fopen (Sleep(10 sec)), the file is still not deleted. The C runtime library uses DeleteFile; 'remove' just calls DeleteFile. I cannot trace DeleteFile. Can anyone explain this behavior?
From: Gaurav on 13 Mar 2010 19:34
Can you explain more about the function and the way you are writing to the file. Its not only about opening file. The way you write to file also matters. Just try the same code on gcc compiler. If if works fine then there might be some problem with the Visual Studio. |