PRB: _harderr() Help Example Missing Backslash in mkdir() Call

ID Number: Q73510

6.00 6.00a 6.00ax

MS-DOS

docerr

Summary:

In Microsoft C versions 5.1, 6.0, 6.0a, and 6.0ax, the online Help

example for the _harderr() function shows how to create your own

critical error handler. However, if you are trying to use this program

to catch a write-protection error, an error in the example prevents a

critical error from being generated.

This problem also exists in the online Help for QuickC versions 2.0,

2.01, 2.5, and 2.51.

More Information:

Generating a critical error from a write-protected disk is expected in

the sample program; however, the program only returns a failure on the

creation of the directory and not a critical error. This occurs

because of an error in the mkdir() line. The line that reads

if( mkdir( "a:\test" ) )

should read:

if( mkdir( "a:\\test" ) )

Notice the extra backslash, which is required because the backslash is

an escape character in C. Without the extra backslash, the program

tries to make "a:<tab>est" where <tab> is the tab character (\t).

Because MS-DOS cannot create this directory because of the tab, the

mkdir() call fails and the critical error handler is never executed.

Additional reference words: 2.00 2.50 6.00 6.00a 6.00ax