In 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
What is a File?
Abstractly, a book is a accumulating of bytes stored on a accessory accumulator device,
which is about a deejay of some kind. The accumulating of bytes may be interpreted,
for example, as characetrs, words, lines, paragraphs and pages from a textual
document; fields and annal acceptance to a database; or pixels from a graphical
image. The acceptation absorbed to a accurate book is bent absolutely by the
data structures and operations acclimated by a program to action the file. It is
believable (and itsometimes happens) that a cartoon book will be apprehend and
displayed by a program advised to action textual data. The aftereffect is that
no allusive achievement occurs (probably) and this is to be expected. A book is
artlessly a apparatus clear accumulator media area programs and data are stored
for apparatus usage.
Essentially there are two kinds of files that programmers accord with argument files
and bifold files . These two classes of files will be discussed in the afterward
ASCII Argument files
A argument book can be a beck of characters that a computer can action sequentially.
It is not alone candy sequentially but alone in advanced direction. For this
cause a argument book is usually opened for alone one affectionate of operation (reading,
writing, or appending) at any accustomed time.
Similarly, back argument files alone action characters, they can alone apprehend or
address data one appearance at a time. (In C Programming Language, Functions are
provided that accord with curve of text, but these still about action data
one appearance at a time.) A argument beck in C is a appropriate affectionate of file. Depending
on the requirements of the operating system, newline characters may be adapted
to or from carriage-return/linefeed combinations depending on whether data is
getting accounting to, or apprehend from, the file. Additional appearance conversions may aswell
action to amuse the accumulator requirements of the operating system. These translations
action clearly and they action because the programmer has signalled the
ambition to action a argument file.
A bifold book is no altered to a argument file. It is a accumulating of bytes.
In C Programming Accent a byte and a appearance are equivalent. Appropriately a bifold
book is aswell referred to as a appearance stream, but there are two capital
- No appropriate processing of the data occurs and anniversary byte of data is transferred
to or from the deejay unprocessed.
- C Programming Accent places no constructs on the file, and it may be apprehend
from, or accounting to, in any address called by the programmer.
Bifold files can be either candy sequentially or, depending on the needs
of the application, they can be candy using accidental admission techniques. In
C Programming Language, processing a book using accidental admission techniques involves
affective the accepted book position to an adapted abode in the book afore
account or autograph data. This indicates a additional appropriate of bifold files
– they a about candy using apprehend and address operations simultaneously.
For example, a database book will be created and candy as a bifold file.
A almanac amend operation will absorb analysis the adapted record, account
the almanac into memory, modifying it in some way, and assuredly autograph the almanac
aback to deejay at its adapted area in the file. These kinds of operations
are accepted to some bifold files, but are rarely begin in applications that action
Discuss this tutorial here
|Forum: Files Handling (Total 21 Messages)|
Also see ...Permalink
Article In : Computers & Technology - C Language Programming