jfcmacro icon

BorrarSemFumadores.cpp

jfcmacro | PRO | 03/22/19 03:58:17 PM UTC | 0 ⭐ | 314 👁️ | Never ⏰ | []
C++ |

480 B

|

None

|

0 👍

/

0 👎

#include <fcntl.h>           /* For O_* constants */
#include <sys/stat.h>        /* For mode constants */
#include <semaphore.h>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
 
using namespace std;
 
int
main(void) {
  const char *nombres[] = { "notabaco", "nopapel", "nocerilla" };
 
  for (int i = 0; i < 3; ++i) {
    if (sem_unlink(nombres[i]) == -1) {
      cerr << "Error borrando los semaforos: " << strerror(errno) << endl;
    }
  }
 
  return EXIT_SUCCESS;
}

Comments