C standard file IO stream
File I/O Streams in C Programming Language :
- In C all input and output is done with streams
- Stream is nothing but the sequence of bytes of data
- A sequence of bytes flowing into program is called input stream
- A sequence of bytes flowing out of the program is called output stream
- Use of Stream make I/O machine independent.
Predefined Streams :
| stdin | Standard Input |
|---|---|
| stdout | Standard Output |
| stderr | Standard Error |
Standard Input Stream Device :
- stdin stands for (Standard Input)
- Keyboard is standard input device .
- Standard input is data (Often Text) going into a program.
- The program requests data transfers by use of the read operation.
- Not all programs require input.
Standard Output Stream Device :
- stdout stands for (Standard Output)
- Screen(Monitor) is standard output device .
- Standard output is data (Often Text) going out from a program.
- The program sends data to output device by using write operation.
Difference Between Std. Input and Output Stream Devices :
| Point | Std i/p Stream Device | Standard o/p Stream Device |
|---|---|---|
| Stands For | Standard Input | Standard Output |
| Example | Keyboard | Screen/Monitor |
| Data Flow | Data (Often Text) going into a program | data (Often Text) going out from a program |
| Operation | Read Operation | Write Operation |
Some Important Summary :
| Point | Input Stream | Output Stream |
|---|---|---|
| Standard Device 1 | Keyboard | Screen |
| Standard Device 2 | Scanner | Printer |
| IO Function | scanf and gets | printf and puts |
| IO Operation | Read | Write |
| Data | Data goes from stream | data comes into stream |
