【发布时间】:2015-07-16 16:52:23
【问题描述】:
/*Creating a special file */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[]){
int result;
if (argc != 2) {
fprintf(stderr, "Usage: ./a.out fifoname\n");
exit (1);
}
result = mknod (argv[1], S_IRUSR| S_IWUSR|S_IFIFO, 0);
if (result < 0) {
perror ("mknod");
exit (2);
}
}
我已经执行了一个示例代码来在 CodeBlocks 中创建一个使用 GCC 编译器的特殊文件......但是代码在 Ubuntu 环境中运行正常...... 是 Windows 环境造成的问题。如果是这样,如何解决在Windows中运行程序的问题?
【问题讨论】:
-
mknod()是SVr4、4.4BSD、POSIX.1-2001函数,Windows都不支持,所以Windows标准库中根本不存在这个函数
标签: c windows gcc operating-system system-calls