Execute the program from the C program

How should I run another program from my C program? I need to be able to write data to the STDIN of the started program (and possibly read from its STDOUT)

I am not sure if this is a standard C function. I need to run under Linux Solution.

you want to use popen. It provides you with a one-way pipeline, you You can use it to access the stdin and stdout of the program.

Popen is the standard configuration of modern unix and unix-like operating systems, and Linux is one of them:-)

Type

man popen

Read more related information in the terminal.

Edit

popen Whether to generate one-way or two-way pipes depends on the implementation. In Linux and OpenBSD, popen generates one-way pipes, which are read-only or write-only. On OS X, FreeBSD and NetBSD, popen produces two-way pipes.

How should I run another program from my C program? I need to be able to write data to the STDIN of the started program (and possibly read from its STDOUT)

I am not sure if this is a standard C function. I need to run under Linux The solution.

You want to use popen. It provides you with a one-way pipe, you can use it to access the program’s stdin and stdout. < p>

Popen is the standard configuration of modern unix and unix-like operating systems, and Linux is one of them:-)

Type

man popen

Read more information in the terminal.

Edit

Whether popen generates one-way or two-way pipes depends on the implementation. In Linux and OpenBSD, popen generates one-way pipes, which are read-only or write-only. On OS X, FreeBSD and NetBSD, popen produces two-way pipes.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2205 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.