Mike - EMAIL IGNORED <[EMAIL PROTECTED]> writes:

> In the code fragment below, I would have expected a
> failure on the second open,

Why would you expect that?

> I would like to generate a failure.  How can I do this?

Use O_EXCL (which exists *just* for that purpose).

> The file is usually, but not always
> present before the program is run.

You can also stat() the file check whether it exists or not, then
change your program logic appropriateley.

>    if (handle1 < 0)
>       cerr << "fail1" << endl;

This is incorrect way to check for syscall failure.
Use "if (handle == -1)" instead (or your code will think that lsee()
past 2GB mark is a failure).

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to