Hello, I'm currently doing noob level UNIX C programming, and I am trying to display output in a new terminal window, and I don't know how to do that. Could any of you gents point me in the right direction please?
Thanks in advance.
Hello, I'm currently doing noob level UNIX C programming, and I am trying to display output in a new terminal window, and I don't know how to do that. Could any of you gents point me in the right direction please?
Thanks in advance.
Do you mean create a new terminal window, or display output?
I'm sorry, I mean running a pager program like less in a new window to display the output.
I'm not following what you want. Try to explain in more than one sentence![]()
you'll have to use execl or similar to execute the command to open a new window (xterm or whatever you use). You'll also have to supply xterm with the correct commandline to execute whatever program (less I think you said) it is supposed to run when it opens.
It is a very stupid request, but I'm working on a class project.
Basically, I am collecting output of a program with a pipe, and trying to display it in a new terminal window by having that new window execute less/more/whatever paging utility the user specifies.
Thank you very much. I never thought to suspect xterm had a command line operator that would take a program I wanted it to run.Originally Posted by sl4nted
I donno if it does, that was an example....Eterm does I'm pretty positive I've done it with that before. xterm may, but don't get your hopes up
edit::
man xterm
I guess it does
-e
same as eterm if I remember right
Last edited by sl4nted; 12-07-2006 at 06:02 PM.
Okay, I got another problem. The information I have is in a pipe. If I write something like execl("/.../xterm", "-e", "less...) ... how can I pass that pipe to forked/execled xtermed less?
by pipe I assume its just a buffer in your program? not the IPC object
:: you could just write it to a file and run less or whatever command on that file
Last edited by sl4nted; 12-07-2006 at 08:01 PM.
It is an IPC object. My program uses it to collect the output of one fork/execl combo and then needs to feed it into another.
Writing it to a file and running less on that file would be the sane way to do it, but this is a school project, so I am required to do everything the non-intuitive way, score a ten semicolon hit combo, and invent the improbability drive without touching the ground.
I take it from your tone that this is a ridiculous question, and it probably is. I know less can read pipes, but I don't know how to give the read pointer of the pipe to the less I'm execling.
I take it from your tone that this is a ridiculous question, and it probably is
-- not at all
I had to do somthing basically like this for university awhile ago (3-4 years), we created a shell, and it piped data between basically any 2 processes. I'm thinking it has to do with using stdin/stdout. But am not positive just yet (but I almost am)....lemme see if I can dig up my old shell program, it should be archive on here somwhere
sry, not seeing it anywhere
I did think maybe you should use popen, but thats not gonna help I don't think since it has to be opened in a seperate xterm
Last edited by sl4nted; 12-07-2006 at 09:08 PM.
Well, I know the only reliable way I have at this point of getting a pipe to be readable to a child process after an exec is by fixing the pipe to stdin/out, but I just need to get less to read out of it.
popen really won't work. But if I have the pipe in stdin/stdout's file descriptor spots before I execl the xterm window, then the pipe will be ACCESSIBLE, but I just need to know how to get less to access it.