Node:BSD Terminal Modes, Next:Line Control, Previous:Terminal Modes, Up:Low-Level Terminal Interface
BSD Terminal Modes
Aug 02, 2021 The GNU C Library version 2.34 is now available. Item posted by Carlos O'Donell on Mon 02 Aug 2021 03:57:01 AM UTC. The GNU C Library The GNU C Library version 2.34 is now available. The GNU C Library is used as the C library in the GNU system and in GNU/Linux systems, as well as many other systems that use Linux as the kernel.
The usual way to get and set terminal modes is with the functions described in Terminal Modes. However, on some systems you can use the BSD-derived functions in this section to do some of the same thing. On many systems, these functions do not exist. Even with the GNU C library, the functions simply fail with errno
= ENOSYS
with many kernels, including Linux.
- C Technical Specifications Implementation Status 1.7. C 2020 Implementation Status 1.8. C TR1 Implementation Status 1.9. C TR 24733 Implementation Status 1.10. C Special Functions Implementation Status 3.1. C Command Options 3.2. C 1998 Library Headers 3.3. C 1998 Library Headers for C Library Facilities 3.4. C 1998 Deprecated.
- The GNU Compiler Collection includes front ends for C, C, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages (libstdc.). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom.
- The GNU C Library defines most of the facilities required by the SVID that are not also required by the ISO C. Or POSIX standards, for compatibility with System V Unix and other Unix systems (such as SunOS) which include these facilities. However, many of the more obscure and less generally useful facilities required by the SVID are not included.
The symbols used in this section are declared in sgtty.h
.
struct sgttyb | Data Type |
Gnu C Library On Computer
This structure is an input or output parameter list for gtty and stty .
|
int gtty (int filedes, struct sgttyb *attributes) | Function |
This function gets the attributes of a terminal.
|
int stty (int filedes, struct sgttyb * attributes) | Function |
This function sets the attributes of a terminal.
|
Node:Standard Streams, Next:Opening Streams, Previous:Streams, Up:I/O on Streams
Standard Streams
When the main
function of your program is invoked, it already has three predefined streams open and available for use. These represent the 'standard' input and output channels that have been established for the process.
These streams are declared in the header file stdio.h
.
FILE * stdin | Variable |
The standard input stream, which is the normal source of input for the program. |
FILE * stdout | Variable |
The standard output stream, which is used for normal output from the program. |
FILE * stderr | Variable |
The standard error stream, which is used for error messages and diagnostics issued by the program. |
In the GNU system, you can specify what files or processes correspond to these streams using the pipe and redirection facilities provided by the shell. (The primitives shells use to implement these facilities are described in File System Interface.) Most other operating systems provide similar mechanisms, but the details of how to use them can vary.
Gnu C Library Reference
In the GNU C library, stdin
, stdout
, and stderr
are normal variables which you can set just like any others. For example, to redirect the standard output to a file, you could do:
Note however, that in other systems stdin
, stdout
, and stderr
are macros that you cannot assign to in the normal way. But you can use freopen
to get the effect of closing one and reopening it. See Opening Streams.
Gnu C Library For Windows
The three streams stdin
, stdout
, and stderr
are not unoriented at program start (see Streams and I18N).