If you can catch the exception using a catch all (catch(...)), then you are likely not catching the MFC exception correctly.
Remember that MFC exceptions are caught by pointer, not by reference or value. And you must call Delete() off of the caught exception pointer if you do not re-throw it.
-=- JamesIf you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
In addition to the above responses, you could also try: (I know WinExec is old but since it works still) WinExec("cmd /c ren c:\\a.txt b.txt", SW_HIDE);
It is the /C switch which causes cmd.exe to terminate after executing the command. And the second parameter to WinExec: SW_HIDE causes the window not to be shown.
If the program should run on Win9X also, then make it command.com instead of cmd.exe.
There was a problem with my program that it always return file pointer = NULL on the second (and further) attemps of openning file. So I tried to print out what error occured by using this command:
String error = strerror(errno) ;
The 'bad file number' was the message that I got in the string error.