-->





Translate

Stream types and file makers bof eof and newline c programming tutorial

Leave a Comment
This C programming tutorial covers two topics

  1. What is stream and its types in c programming
  2. How to use file makers EOF, BOF and newline 


What is a stream in  c programming? Also discuss its different types.
File:
The data is stored in the form of file
A file is a set of related records.
Stream:

  • It is a logical interface to a file.
  • It is associated to a file using an open operation.
  • It is not associated to a file using a close operation.
  • Stream refers to flow of data from source is know as reading ,fetching, getting or extracting the data.
  • The process of producing output data to the destination is know as writing, storing, inserting or putting the data.

There are two types of streams.

  1. Text stream
  2. Binary stream

Text stream:

  • A text stream is a sequence of characters.
  • Character translation may occur in a text stream e.g. new line is represented as carriage return.
  • There may not be one to relation between the characters written and those on the external device.

Binary Stream:

  • It is a sequence of bytes.
  • The number of bytes written or read is always the same as those on the external device.it means there is one to one relation between the bytes written or read and those on the external device.
  • No character translations occur in binary stream.
  • Some additional bytes such as the file sector on the disk are added to to the binary stream.


What are file markers? Explain the use of BOF, EOF and New Line in c programming.

  • A file contains a numbers of characters or bytes each file stored on a disk has a start and an end.
  • The start of first byte or character is called beginning of file(BOF).
  • The end of last byte or character is called End of file (EOF).
  • The position where data read or data write operations are performed is called current position.
  • EOF character are placed after the last character i C.
  • Enter key is used in text editor for new line but in C new line character is \n to be placed at the of each line.

0 comments:

Post a Comment