标签:
#include <fcntl.h> #include <iostream> #include <unistd.h> using namespace std; int main() { int flags = fcntl(STDOUT_FILENO, F_GETFD); flags |= FD_CLOEXEC; fcntl(STDOUT_FILENO, F_SETFD, flags); if ( fork() == 0 ) { execlp("ls", "ls", (char*)NULL); } cout << "input flags = "; cin >> flags; cout << flags << endl; return 0; }
标签:
原文地址:http://www.cnblogs.com/kaishan1990/p/5284456.html