CITS2002 Systems Programming |
next → | CITS2002 | CITS2002 schedule | ||||
Raw input and outputWe've recently seen how C11 employs arrays of characters to represent strings, treating the NULL-byte with special significance.At the lowest level, an operating system will only communicate using bytes, not with higher-level integers or floating-point values. C11 employs arrays of characters to hold the bytes in requests for raw input and output.
File descriptors - reading from a fileUnix-based operating systems provide file descriptors, simple integer values, to identify 'communication channels' - such as files, interprocess-communication pipes, (some) devices, and network connections (sockets).In combination, our C11 programs will use integer file descriptors and arrays of characters to request that the operating system performs input and output on behalf of the process - see man 2 open.
Note that the functions open, read, and close are not C11 functions but operating system system-calls, providing the interface between our user-level program and the operating system's implementation.
CITS2002 Systems Programming, Lecture 7, p1, 12th August 2024.
|