Re: openpty() function



Thank you for your quick reply.
I gonna try your piece of code :)

Lew Pitcher a écrit :

PaowZ wrote:
Hello there,

I'm trying to program a little app where I need to input data into a
first terminal (the one I launch the process) and to ouput data into
another terminal. So I need to open a terminal during execution.
Aftersome searches, I got interested in openpty() function.
I read some examples and man-pages but something is not very clear in
my mind.
Does this function allow opening new terminal or what ?
Do I expect the right aim of this function ?

Nope. openpty(3) has nothing to do with launching an xterm window.

In simple terms, openpty(3) opens a pair of pipes that look like serial
devices. This sort of thing is commonly used so that one program can
feed data to a second program that expects to get it's data from
/dev/tty.

You probably want to use popen(3) and family, sort of like

FILE *lister;

if ((lister = popen("/usr/X11R6/bin/xterm -e more /dev/tty","w")) ==
NULL)
error("Error -cant pipe to new xterm");
else
{
fprintf(lister,"This is a test\n");
pclose(lister);
}



'Cause when I run my prog, nothing happens, so I wonder :S
Here the lines:
int master, slave;
if (openpty ( &master, &slave, NULL, NULL, NULL) < 0)
error("Error !!!");

Thanks a lot :)

.



Relevant Pages

  • Re: openpty() function
    ... I'm trying to program a little app where I need to input data into a ... first terminal (the one I launch the process) and to ouput data into ... openptyopens a pair of pipes that look like serial ... This sort of thing is commonly used so that one program can ...
    (comp.os.linux.development.apps)
  • Re: Sort order - Data midified / Created
    ... Under "Date formats" there is a drop down menu that you click called "Short date:" it is here you can choose the format you would like to have your dates display in. ... you can change or add many different heading in columns to view and sort the different properties that different apps will let you set when you fill in the fields in the properties sheet for the file you have created and or add your own Custom properties if allowed depending on the application. ... That being said there are many ways you can display the information about files and folders from within Windows Explorer from Stacking, filtering, grouping and using the search box at the top of Windows Explorer. ... Open control panel type "Folder options" in the dialog that opens under the search tab check the box next to use natural language search. ...
    (microsoft.public.windows.vista.general)
  • Explorer and Internet Explorer Still Sick
    ... for a Runtime error 216 at the same instruction. ... it may start to launch and then go ... I have tried getting a debugger to open their code by clicking Cancel in the ... Application Error dialog box, but even though the debugger opens, no ...
    (microsoft.public.windowsxp.general)
  • Re: confused about normal.dot
    ... it turns out that the reason my Word opens and updates ... > This message is posted to a newsgroup. ... I'm pretty new to Word Automation from VB. ... >> If I do all this outside of automation, that is launch 2 copies word form ...
    (microsoft.public.word.docmanagement)
  • Re: Vertical Ruler problem
    ... you'll see "Hide White Space." ... > I cannot adjust the vertical ruler at all. ... > a document I created before the problem, it opens in ... > another launch of Word and looks and works correctly. ...
    (microsoft.public.word.pagelayout)