C language to call Linux commands

Source: Internet
Author: User
C language to call Linux commands-general Linux technology-Linux programming and kernel information, the following is a detailed description. System (""); popen

Exec Series

Execl and other similar functions can execute commands in any shell.

# Include

Int
Main (){
System ("ls-l ");
Return 1;
}

Or

Int execl (const char * path, const char * arg ,...);
Int execlp (const char * file, const char * arg ,...);
Int execle (const char * path, const char * arg,..., char * const envp []);
Int execv (const char * path, char * const argv []);
Int execvp (const char * file, char * const argv []);

Alternatively, the difference is that the former can be executed but not exited. After the latter is executed, it will be released correctly. If the error is returned, it will not exit. Continue with the following statement.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.