What is a File? What are the Basic Operations Performed on Files?
https://www.computersprofessor.com/2016/06/what-is-file-what-are-basic-operations.html
A file is a collection of
records, each record provides info to the user. These files are arranged in the
disk and can be accused through file handling fns provides by the standard C
library.
(OR)
A file is a placed on the
disk where a group of related data is stored.
In C language there are two
categories of files:
1. Text (or) formatted
files.
2. Binary ( or) unformatted
files.
Text
data files:
Text data file is a
sequence of characters. A text file consists of multiple lines. Each line is
separated by a new line character and last line is terminated by on end of file
mark. The characters are translated into human readable form when retrieve.
Binary
data files:
A binary file is a sequence of bits organized in the form of blocks. There
sequence of bits doesn’t have any end of line or end of file mark. There is no
character translation in binary files.
The file consists of large
amount of data, which can be read or modify depending up on the requirement. C
supports a number of a number of functions that have the ability to perform basic file
operations, which include:
Naming a file..
Opening a file.
Reading data from a file.
Writing data to a file, and
closing a file.
These operations are performed with the help
of a structure FILE and a file pointer.
File pointer:
File pointer
is a pointer to the info stored in the file. It define various things about the
file. Such as its name, status and current active position on it. The file
pointer is a pointer variable of type FILE and can be declared as follows:
Syntax: FILE File –pointer;