The C language does not have any I/O capability! You can access files and devices via two groups of functions, these can be split as shown below.
Low level functions reference files by a file descriptor, this descriptor is created with the open function and can be referenced by functions like:
close
read
write
mmap - Memory map (Not supported on Linux).
ioctl I/O control.
Three 'file descripters' are opened automatically when your program runs. These are:
File Default Desc Name device ---- ---- ------ 0 stdin Keyboard 1 stdout Screen 2 stderr ScreenIf you want to use these 'file descriptors', you do not have to issue an 'open'.
Devices: Devices are generally accessed in C by non-standard extensions to the language which define the ports, pins, and onboard hardware control registers of the device being programmed. For example, on a PIC microcontroller, the label TRISA1 can be set or cleared to decide the direction of the first general function IO pin. TRISA1 = 0 would set it as an output pin.
Also:
See also:
Top | Master Index | C Keywords | Functions |