日期:2014-05-16 浏览次数:20678 次
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <limits.h> int main( int arg_num, char *arg[] ) { // int fd = open("/home/dm/exercise/file1d2",0|O_CREAT|O_EXCL); int fd = open(*arg, 0); int max = sysconf(_SC_MQ_OPEN_MAX); max = sysconf(_SC_OPEN_MAX); if (fd == -1) { printf("open fail \n"); return 1; } printf("open ok %d", fd); printf("\n\n"); return 0; } //int open (const char *name, int flags); //int open (const char *name, int flags, mode_t mode);