Monday, 23 February 2015

FILE HANDLING IN C


File
=====

File Handling In C is Very Simple. As it essentially Treats a File as Just Stream of Characters and accordingly allows to input and output to the file.

Steps To Handle a File
=======================

1) Open The File
2) Access The File
3) Close The File

Syntax For To Declare a File Pointer
====================================

FILE *p;

p=fopen("FileName","Mode");


Mode
====
r - ReadMode
w - WriteMode
a - AppendMode

r+ - Read+Write
w+ - Write+Read
a+ - Append+Read

File Handling Functions
========================

Character Oriented Functions
============================
1) fgetc()
2) fputc()

String Oriented Functions
============================
1) fgets()
2) fputs()

Reading & Writing Records To The File
=====================================
1) fwrite()
2) fread()

Formatted IO Functions
============================
1) fprintf()
2) fscanf()

No comments:

Post a Comment