zoukankan      html  css  js  c++  java
  • 自己写的一个vii总结

    #include<stdlib.h>
    #include<stdio.h>
    #include<unistd.h>
    #include<errno.h>
    #include<error.h>
    #include<string.h>
    int main(int argc ,char **argv)
    {
    if(argc != 2)
    {
    printf("Usage:%s <xxx.c> ",argv[0]);
    exit(0);
    }

    FILE *fp = fopen(argv[1],"a+");
    if(fp == NULL)
    {
    fprintf(stderr,"fopen (%s) is failed:%s ",argv[1],strerror(errno));
    exit(0);
    }

    fputs("#include<stdlib.h> ",fp); //将一个字符串输出到file *stream中。

    fputs("#include<stdio.h> ",fp);
    fputs("#include<string.h> ",fp);
    fputs("#include<error.h> ",fp);
    fputs("#include<errno.h> ",fp);
    fputs("#include<unistd.h> ",fp);
    fputs("#include<strings.h> ",fp);
    fputs("#include<stdbool.h> ",fp);

    fputs("#include<sys/stat.h> ",fp);
    fputs("#include<sys/types.h> ",fp);
    fputs("#include<sys/wait.h> ",fp);
    fputs("#include<fcntl.h> ",fp);
    fputs("int main(int argc,char **argv)",fp);
    int fe = fflush(fp);
    if(fe == EOF)  //error of file
    {
    fprintf(stderr,"flush (%s),failed:%s ",argv[1],strerror(errno));//如果出错,输出错误信息
    }
    fclose(fp);
    // fopen(argv[1],"a+");

    return 0;

    }

    //本程序基本实现了vii的功能,还有一点缺陷就是,运行这个程序之后,所创建的文件不能直接以打开的形式呈现,需要另外vim file.c 才能进入vi界面。需要进一步完善。

  • 相关阅读:
    D:yyyUNetSegmentation_code_20180301data rain
    第六课cnn和迁移学习-七月在线-cv
    lecture7图像检索-七月在线-cv
    lecture4特征提取-七月在线-cv
    guling code细节
    resNet代码-小象/cv
    unet网络讲解,附代码
    数字三角形
    递归折半查找
    分治法寻找第k大的数
  • 原文地址:https://www.cnblogs.com/defen/p/5188255.html
Copyright © 2011-2022 走看看