[clug] Pseudo terminals

Adrian Blake adrian.blake at ieee.org
Wed Jul 18 07:58:20 GMT 2007

Within  a Fortran program I can open up a terminal with a system command like:   call system("xterm -T new &" , result)

This creates a device   /dev/pty/x   x is some number

I then  would like to be able to direct output to that device:  OPEN (UNIT=15, FILE="/dev/pts/x", STATUS="OLD", ACCESS="STREAM") , 
but how can I determine the value of x?

I could do : ps -ax | grep pty/     and then pick the greatest numbered pty.  Clumsy under program control.

Any suggestions?

Adrian Blake
Molonglo Radio Observatory
University of Sydney
1152 Hoskinstown Rd
Bungendore 2621
ph. 02 80042212  mobile 0407 232 978

More information about the linux mailing list