ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
the first program is real-time output program, how "my program" real-time read the redirect output from "first program"? loop read the argv[1]?can somebody write a simple code in follow... thanks
the "first program" realtime output pixel data to standardout, I wish "my program" can dealwith these pixel data then output to standardout.
I use c++ on Red hat 9.0.
the problem is I am not sure how to realtime read these input data. How to open and read the pipe, " | ", in my program? just read argv[1]? how to ensure realtime.
1, the stdout points screen
2, i wish it can combin in one program, but "first program" should be any specifed file, no source code. I once use this way:
dup2(fds[0],stdout_fileno);
execlp("first program","first program", NULL);
however, it cannot work. I think the reason is firt program take place the current program. Do you have idea to do the output redirecting in proram.
3,"|" points shell command redirecting. you know, I try to use shell comand to do the above work.
i think you might be confused as to what stdout deals with. here is a link that better explains the usage of stdout with many extra references: http://www.wlug.org.nz/stdout(3)
So "first program" is not realy a program at all, it's just a file?
If "first program" is just a file name, try setting a character string to it:
This executes an XTerminal. You can change the shellCommand to what ever you need. Maybe make a whole bunch of pointers to shell commands. Then use a case statement to decide what command needs to be used.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.