LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   redirect into C++ without a file ? (https://www.linuxquestions.org/questions/programming-9/redirect-into-c-without-a-file-174040/)

C++Boar 04-24-2004 10:17 AM

redirect into C++ without a file ?
 
I am quite new to linux, but I have been thinking about doing some gui-programming for some commandline-programs that has no gui (and could use it).

This is not the case but if I wanted to make a grafical ls program I could write something like

system("ls > result.temp")
... read from result.temp
... show gui with result.tmp

But I don't want to create a (temporary) and read from it ...

I could also try something like
system("mycommand --output | ls")
but that would just create a new process and I need someway to signal the output into the old process. (?)

And all I want to do is the simple thing like
char buffer [large]; (or maybe string)
system ( ls > buffer )

Am I overlooking a very simple solution here ?
Hope somebody will/can help me.

C++Boar

kooch 04-24-2004 10:20 AM

depends on what you need exactly but:
man pipe
man fifo

might be enlightening


All times are GMT -5. The time now is 10:25 PM.