On FC4 with g++ (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8):

In the code fragment below, I would have expected a
failure on the second open, but I find this is not
the case.  I would like to generate a failure.  How
can I do this?  The file is usually, but not always
present before the program is run.

Thanks for your help.
Mike.

   const char* const      filePath = "a_file";

   int handle1 = ::open(filePath,O_RDWR|O_CREAT,0600);
   if (handle1 < 0)
      cerr << "fail1" << endl;

   int handle2 = ::open(filePath,O_RDWR|O_CREAT,0600);
   if (handle2 < 0)
      cerr << "fail2" << endl;





_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to