File Processing
File Operations
In C, you can perform four major operations on the file, either text or binary:
- Creating a new file
- Opening an existing file
- Closing a file
- Reading from and writing information to a file
•File Definition
–File
is a collection of record
–Record
is a collection of field
–Field
is a block of byte
–Byte
is collection of bit
•Possible
mode value :
Mode Description
“r” opening a file
to be read.
“w” creating a file
to be written.
“a” opening a File
for data append.
“r+” opening a File
for read/write.
“w+” creating file
for read/write.
“a+” opening a File
for read/append
“rb” opening a File (binary) to be read.
“wb” creating a file (binary) for write operation.
•Closing
a File using fcloseall():
int fcloseall (void);
üClose
all active stream except: stdin, stdout, stdprn, stderr, and stdaux.
üWill
return the number of stream closed if successful, and return EOF instead.
üHeader
file <stdio.h>
SOURCE : BINUS MAYA PPT AND PROGRAMIZ
Comments
Post a Comment