Book Administration in C Accent
| |
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
files.
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
sections.
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.
Bifold files
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
differences.
- 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
argument files.
Discuss this tutorial here
Forum: Files Handling (Total 21 Messages) | |||
Also see ...
Unions & Structures
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
What Is a Stream? :: Ascribe & Achievement
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
Unions & Structures
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
What Is a Stream? :: Ascribe & Achievement
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
Unions & Structures
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
What Is a Stream? :: Ascribe & Achievement
PA beck is a arrangement of characters. Added exactly, it is a arrangement of bytes of data. A arrangement of bytes abounding into a program is an ascribe stream; a arrangement of bytes abounding out of a program is an achievement stream. By absorption on streams
Unions & Structures
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
Unions & Structures
What is a Union?/h1PIf we are accepting the beneath anamnesis to use in our program, for archetype 64K, we can use a individual anamnesis area for added than one capricious this is alleged union. You can use the unios in the followig locations./Pp
Arrays & Strings
What is an Array?/h2PWe can accord a academic analogue of array. An arraty is artlessly a amount of anamnesis locations, anniversary of which can abundance the aforementioned data blazon and which can be references through the aforementioned capricious name. /P
Book Administration in C Accent
PIn 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 files. /Ph1What is a File?/h1PAbstractly, a book is a accumulating of byt
|
Forum: Files Handling (Total 21 Messages)