What Is a Stream? :: Ascribe & Achievement
| |
A beck is a arrangement of characters. Added exactly, it is a arrangement of bytes
of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement
of bytes abounding out of a program is an achievement stream. By absorption on streams,
we don t accept to anguish as abundant about area they re traveling or area they originated.
The above advantage of streams, therefore, is that input/output programming
is accessory independent. Programmers don t charge to address appropriate input/output
functions for anniversary accessory (keyboard, disk, and so on). The program sees input/output
as a connected beck of bytes no amount area the ascribe is advancing from or
traveling to.
Every C beck is affiliated to a file. In this context, the appellation book doesn t
accredit to a deejay file. Rather, it is an average move amid the beck
that the program deals with and the absolute concrete accessory getting acclimated for ascribe
or output. For the alotof part, the alpha C programmer doesn t charge to be
anxious with these files, because the data of interactions amid streams,
files, and accessories are taken affliction of automatically by the C library functions
and the operating system.
Modes of Streams in C Language
C streams can be disconnected into two modes: argument and binary.
Text Stream
A argument beck consists alone of characters, such as argument data getting beatific to
the screen. Argument streams are organized into lines, which can be up to 255 characters
continued and are concluded by an end-of-line, or newline, character. Assertive characters
in a argument beck are accustomed as accepting appropriate meaning, such as the newline
character.
Binary Stream
A bifold beck can handle any array of data, including, but not bound to,
argument data. Bytes of data in a bifold beck aren t translated or interpreted
in any appropriate way; they are apprehend and accounting absolutely as-is. Bifold streams
are acclimated primarily with deejay files.
Predefined Streams
ANSI C has three predefined
streams, aswell referred to as the accepted input/output files. If you re
programming for an IBM-compatible PC active DOS, two added accepted
streams are accessible to you. These streams are automatically opened if a C
program starts active and are bankrupt if the program terminates. The
programmer doesn t charge to yield any appropriate activity to create these streams
available. Table lists the accepted streams and the accessories they commonly are
connected with. All 5 of the accepted streams are text-mode
streams.
| The 5 standard streams. | ||
|---|---|---|
| NAME | STREAM | DEVICE |
| stdin | Standard Input | Keyboard |
| stdout | Standard Output | Screen |
| stderr | Standard Error | Screen |
| stdprn* | Standard Printer | Printer (LPT1) |
| stdaux* | Standard Auxiliary | Serial Anchorage (COM1) |
| (*) Accurate alone beneath DOS | ||
Whenever we accept to use the printf() or puts() functions to affectation argument on-screen,
we use the stdout stream. Likewise, if we use gets() or scanf() to apprehend keyboard
input, we use the stdin stream. The accepted streams are opened automatically,
but additional streams, such as those acclimated to dispense advice stored on disk,
haveto be opened explicitly.
|
streams, stream, input, output, standard, program, binary, bytes, files, sequence, characters, special, device, functions, automatically, , streams are, standard streams, input output, text stream, binary stream, |
Also see ...
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
PIn this section, we will altercate about files which are actual important for all embracing data processing. Data are stored in data files and programs are stored in program files. /Ph1What is a File?/h1PAbstractly, a book is a accumulating of byt
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp