MCS-011 Problem Solving and Programming

First year, Semester 1

Chapters

Newsletter

This unit covers methods of working with files and a data structure for data storage in C programming. It explains that data stored in variables is lost when the program exits unless saved to a file. C handles files as sequential streams of bytes, with each file ending either with an end-of-file marker or a specified byte number. C supports binary files and text files, which differ in storage format. Text files store data as text, potentially with character translations (e.g., newline to carriage return), while binary files store data in the same format as in memory, making them more efficient for numeric values.

Disk I/O in C uses library functions defined by the ANSI standard and originally written for UNIX. There are two types of file systems: buffered and unbuffered. This unit will first cover buffered file functions and then unbuffered file functions.

Objectives:

After going through this unit you will be able to:

  1. define the concept of file pointer and file storage in C;
  2. create text and binary files in C;
  3. read and write from text and binary files;
  4. deal with large set of Data such as File of Records; and
  5. perform operations on files such as count number of words in a file, search a word in a file, compare two files etc.

Report an issue

Reporting: Unit-12 Files (chapter)

Related Posts