Hello,
After I upgraded my development machine and test machine to windows 7 and 8, my programs open a window (cancel, retry or ignore) when a file or disk is not found:
FILE *fOut = fopen(.......
if (fOut == NULL) {
....
}
It looks that Windows pops up the retry windows before the 'if' command, and this is very annoiyed. Is there any way to say windows to work as it did in previous versions? are more people having this problem or am I the only rare person having this issue?
P.S.: It happens to me also that signal() is not cathing crashes as in windows XP or Vista, now a window appear to notify the user about it. My signal-dedicated function does not work any longer. the same to you?
Thanks.
Opening files in windows 7&8
Moderators: hgm, Rebel, chrisw
-
- Posts: 620
- Joined: Fri Feb 08, 2008 10:44 am
- Location: Madrid - Spain
-
- Posts: 686
- Joined: Thu Mar 03, 2011 4:57 pm
- Location: Germany
Re: Opening files in windows 7&8
Hi Fermin,
I'm using this little helper function. This works both in XP and Win7.
Thomas...
I'm using this little helper function. This works both in XP and Win7.
Code: Select all
bool fileExists(string filename)
{
ifstream ifile(filename.c_str());
return (ifile != NULL);
}
-
- Posts: 620
- Joined: Fri Feb 08, 2008 10:44 am
- Location: Madrid - Spain
Re: Opening files in windows 7&8
This look like a C++ function which it is not in pure C.tpetzke wrote:Hi Fermin,
I'm using this little helper function. This works both in XP and Win7.
Thomas...Code: Select all
bool fileExists(string filename) { ifstream ifile(filename.c_str()); return (ifile != NULL); }
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: Opening files in windows 7&8
Does it depend on the folder where you want to open a file?
Does it also happen if you provide the absolute path to the file?
Could it be a permission problem?
Win7 (like Vista) has UAC = User Access Control, which is one of the most annoying things I have ever seen. It can be disabled via Control Panel.
Sven
Does it also happen if you provide the absolute path to the file?
Could it be a permission problem?
Win7 (like Vista) has UAC = User Access Control, which is one of the most annoying things I have ever seen. It can be disabled via Control Panel.
Sven
-
- Posts: 481
- Joined: Thu Apr 16, 2009 12:00 pm
- Location: Slovakia, EU
Re: Opening files in windows 7&8
Have you tried SetErrorMode(SEM_FAILCRITICALERRORS)?Kempelen wrote:Hello,
After I upgraded my development machine and test machine to windows 7 and 8, my programs open a window (cancel, retry or ignore) when a file or disk is not found:
FILE *fOut = fopen(.......
if (fOut == NULL) {
....
}
It looks that Windows pops up the retry windows before the 'if' command, and this is very annoiyed. Is there any way to say windows to work as it did in previous versions?
From MSDN:
SEM_FAILCRITICALERRORS:
The system does not display the critical-error-handler message box. Instead, the system sends the error to the calling process. Best practice is that all applications call the process-wide SetErrorMode function with a parameter of SEM_FAILCRITICALERRORS at startup. This is to prevent error mode dialogs from hanging the application.
-
- Posts: 620
- Joined: Fri Feb 08, 2008 10:44 am
- Location: Madrid - Spain
Re: Opening files in windows 7&8
Thanks this is the solution. I also solves signal catching.rvida wrote:Have you tried SetErrorMode(SEM_FAILCRITICALERRORS)?Kempelen wrote:Hello,
After I upgraded my development machine and test machine to windows 7 and 8, my programs open a window (cancel, retry or ignore) when a file or disk is not found:
FILE *fOut = fopen(.......
if (fOut == NULL) {
....
}
It looks that Windows pops up the retry windows before the 'if' command, and this is very annoiyed. Is there any way to say windows to work as it did in previous versions?
From MSDN:
SEM_FAILCRITICALERRORS:
The system does not display the critical-error-handler message box. Instead, the system sends the error to the calling process. Best practice is that all applications call the process-wide SetErrorMode function with a parameter of SEM_FAILCRITICALERRORS at startup. This is to prevent error mode dialogs from hanging the application.