Skip to main content
11 events
when toggle format what by license comment
Feb 19, 2024 at 18:17 answer added Michael Quad timeline score: 0
Feb 18, 2024 at 1:14 comment added Stephen Harris you need to rethink your problem. In Unix you normally don't need to know the terminal your application is connected to. The OS handles it for you, your app doesn't need to do anything. You don't need to open /dev/pts/0. At most if you need a terminal your code calls isatty() and aborts if not; otherwise the OS does it all for you.
Feb 17, 2024 at 18:52 comment added Michael Quad yes, those i know, i found this manual gnu.org/software/libc/manual/html_node/… it also says that file descriptors can be opened but going by the link "Low-level Input/Output" that information cant be found..
Feb 16, 2024 at 11:59 comment added Stephen Harris By convention, on Unix, 0 is STDIN (input), 1 is STDOUT (output), 2 is STDERR (error). The terminal program (gnome-terminal) will set these up for you when it creates the shell, and the programs you run from the command line will inherit them. If you run a program other ways (eg from the cron task scheduler) then these are set up differently; there's no terminal in this case. It all depends on how the prgram is started as to where 0/1/2 point.
Feb 16, 2024 at 9:39 comment added Michael Quad the ttyname function worked - it returned me /dev/pts/0 for both 0 and 1.. so is it a unified input/output "slave" that i must open and work on? in windows you create two "handles" with CreateFileA feeding it with CONIN$ and CONOUT$ names.. oke, ill go on experimenting..
Feb 16, 2024 at 2:50 comment added Stephen Harris You might want to read man 4 pts to get a fuller understanding of how ptys work and when you would use ptsname. From inside a gnome-terminal you directly have access to "slave" filedescriptor and would use ttyname() instead.
Feb 16, 2024 at 1:57 history edited Michael Quad CC BY-SA 4.0
edited title
Feb 16, 2024 at 1:56 history edited Michael Quad CC BY-SA 4.0
added 10 characters in body
Feb 16, 2024 at 1:55 history edited Michael Quad CC BY-SA 4.0
added 18 characters in body
S Feb 16, 2024 at 1:55 review First questions
Mar 1, 2024 at 2:02
S Feb 16, 2024 at 1:55 history asked Michael Quad CC BY-SA 4.0