【问题标题】:Opening .txt file in execl()在 excel() 中打开 .txt 文件
【发布时间】:2012-11-18 11:09:10
【问题描述】:

如何使用execl() 函数打开.txt 文件? c中是否还有其他功能可以在Ubuntu中打开gedit中的文件。

问候

【问题讨论】:

    标签: c file ubuntu exec


    【解决方案1】:

    c中有没有其他函数可以在gedit中打开文件

    最简单的应该是

    system("gedit file.txt");
    

    作为旁注,您可能想查看xdg-open

    【讨论】:

      【解决方案2】:

      你也可以试试这个

      execlp("/usr/bin/gedit","gedit","text.txt",NULL);
      

      execl()execlp() 的一般语法

      int execl(const char *path, const char *arg, ...);
      int execlp(const char *file, const char *arg, ...);
      

      给出text.txt的完整路径

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-09-23
        • 1970-01-01
        • 1970-01-01
        • 2017-05-13
        • 1970-01-01
        • 2021-03-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多