• Linux exec函数族


    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://tuhao.blogbus.com/logs/22833492.html

    extern char **environ;

    int execl(const char* fullpath, const char* arg, ...); 
    int execlp(const char* file, const char* arg, ...); 
    int execle(const char* fullpath, const char* arg , ..., char* const envp[]); 
    int execv(const char* fullpath, char* const argv[]); 
    int execvp(const char* file, char* const argv[]);  
    int execve(const char* fullpath, const char* arg[] , char* const envp[]);

    int execl(const char* fullpath, const char* arg, ....)
    使用范例:execl(“/bin/ls”, ”ls”, ”-al”, NULL)

    int execlp(const char* file, const char* arg, ....)
    使用范例:execlp(“ls”, ”ls”, ”-al”, NULL)

    int execle(const char* fullpath, const char* arg, ...., char* const envp[])
    使用范例:execle(“/bin/ls”, ”ls”, ”-al”, NULL, environ)

    int execv(const char * fullpath, char* const argv[])
    使用范例:execle(“/bin/mkdir”, argv)  // int main(int argc, char* argv[])

    char* const p[] = {"a.out", "testDir", NULL};
    execv("/bin/mkdir", p);

    int execvp(const char* file, const char* arg, ....)
    使用范例:execlp(“ls”, argv)  // int main(int argc, char* argv[])

    char* const p[] = {"a.out", "testDir", NULL};
    execvp("mkdir", p);

    int execve(const char* fullpath, const char* arg, ...., char* const envp[])
    使用范例:execve(“/bin/ls”, argv, environ)

    char* const p[] = {"a.out", "testDir", NULL};
    execve("/bin/mkdir", p);

  • 相关阅读:
    STL源代码剖析——STL算法之set集合算法
    iOS + Nodejs SSL/Https双向认证
    C语言将10进制转为2进制
    图的遍历算法
    Web—CSS概述
    苹果新的编程语言 Swift 语言进阶(八)--属性
    UVa 10700
    C++实现KMP模式匹配算法
    软件project
    oralce GROUPING SETS
  • 原文地址:https://www.cnblogs.com/hnrainll/p/2032045.html
Copyright © 2020-2023  润新知