Conoscere il file-devide pts associato ad un Terminale o console con la funzione esterna ttyname()
Da Gambas-it.org - Wikipedia.
Versione del 17 lug 2016 alle 09:58 di Vuott (Discussione | contributi) (Creata pagina con "La funzione esterna ''ttyname( )'', dichiarata nel file header "''/usr/include/unistd.h''", consente di conoscere il nome del file-device ''pts'' associato ad un Terminale o a...")
La funzione esterna ttyname( ), dichiarata nel file header "/usr/include/unistd.h", consente di conoscere il nome del file-device pts associato ad un Terminale o alla console utilizzati dall'applicazione Gambas.
E' necessario richiamare in Gambas la libreria dinamica considivisa: "libc.so.6"
Mostriamo un semplice esempio:
Library "libc:6" ' char * ttyname (int filedes) ' Return the pathname of the terminal FD is open on, or NULL on errors. Private Extern ttyname(filedes As Integer) As String Public Sub Main() Dim s As String s = ttyname(0) Print "Il file pts associato al terminale/console è: "; s End
Riferimenti
- http://man7.org/linux/man-pages/man3/ttyname.3.html
- https://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_node/libc_345.html#SEC354
- https://en.wikipedia.org/wiki/Device_file
- https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rttty.htm
- http://pubs.opengroup.org/onlinepubs/009695399/functions/ttyname.html