源码

在c程序中使用Ubuntu上的mknod


我正在尝试制作一个c程序,我正在使用mknod命令

#include
#include
#include

char info[50];

main() {
    int fdr;
    int rc = mknod("testfile",'b',0);
    if(rc<0) {
        perror("Error in mnod");
    }
    fdr=open("testfile",O_RDONLY);
    read(fdr,info,50);
    printf("/n Received message=%s",info);
    printf("/n");
} 

并做一些事情.它在Red Hat系统上运行良好,但在ubuntu上失败,给出了错误无效的参数.

(0)

本文由 投稿者 创作,文章地址:https://blog.isoyu.com/archives/zaicchengxuzhongshiyongubuntushangdemknod.html
采用知识共享署名4.0 国际许可协议进行许可。除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。最后编辑时间为:9月 12, 2019 at 11:23 下午

热评文章