0% found this document useful (0 votes)
13 views

File Structures

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

File Structures

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

File Processing Operations

• Physical Files
• Logical Files
Opening Files
• Open an existing file
• Create a new file

• In C or C++
– fd = open(filename, flags, [, pmode]);
Closing a file
Reading and Writing
Files with C Streams and C++ Stream classes

• I/O operations in C and C++ are based on


concept of streams.
• 2 different styles of manipulating files in C++
– Standard C functions used in header file stdio.h
– Stream classes of header files iostream.h and
fstream.h
• Predefined stream objects cin and cout
represent the standard input and output files.
• The main class for access to files fstream as
defined in iostream.h and fstream.h has two
constructors and variety of methods.
Program in C++ to display the contents of the
file
Seeking
Seeking with C streams
Seeking with C++ stream Classes
Field and Record Organization
• Data Persistent
• Field
• Record
A Stream file
Field Structures
Reading a stream of fields
Record Structures

You might also like