Fundamental concept of Problem solving
Problem solving strategies
Program design & implementation
Introduction to C
Introduction to C
How to open C program code window
Description of C code window
Editing File
Saving and Running a program
The components of C language
Structure of C Program
A sample of C language program
C character set and keywords
C character set and keywords
The C character set
Key words
Data Types
Data Types
Primary Data Type
Secondary Data Type
Rules for constructing variables names
Variable declaration
Assigning values to variables
Scope of variables: Local & Global
Character constants
Integer constants
Real constants
Logical & String constants
C instruction set
Type Declaration & Input/Output Instructions
Arithmetic Instructions
Control Instructions
Arithmetic operators
Relational operators
Logical operators
Increment & Decrement operators
Bitwise operators
Conditional & ternary operators
The comma operators
Size of operator
Assignment operator
Type modifier
Evaluation of expression
Automatic type conversion
Basic Input/Output
Console I/O function
Disc & Port I/O function
Control Structures
Sequence control statements
Decision control & conditional statements
Case control statements
Repitition & loop control statements
Some more statements
Array and String
Introduction of Array
Array Declaration
Array Initialization
Two Dimensional Array
Multi Dimensional Array
Function and Recursion
Function Definition
Function Declaration
Function Call
Pointer expression
Pointer & functions
Pointer & Array
Multi Dimensional Arrays & Pointer
Arrays of Pointer
Use of Pointer & functions
Giving values to member
Structure Initialization
Comparison of structure variables
Arrays of structures
Arrays within structures
Structures within structures
Passing structure to function
Accessing a union member
Initialization of Union variable
Uses of Union
Dynamic Data Structure
Linked list
Data File Handling through C
File operation
Opening & closing a data file
Creating a data file
Processing a data file
Unformatted data file
C Preprocessor & Macro
Macro substitution directives
File inclusion
Compiler control directive
Command line parameter of C
Command line parameter
Header file
Header file
Use of library functions
Some Useful library functions

Data File Handling through C

Unformatted data file

Some applications involve the use of data files to store block of data, where each block consists of a fixed number of contiguous bytes.
Each block will generally represent a complex data structure, such as a structure or an array.
For example, a data file may consist of multiple structures having the same composition, or it may contain multiple arrays of the same type and size.
For such applicators it may be desirable to read the entire block from the data, or write the entire block to the data file, rather than reading or writing the individual components (i.e., structure members of array elements) within each block separately.
The library functions fread and fwrite are intended to be used in situations of this type.
There functions are often referred to as unformatted read and write functions. Similarly, data files of this type are often referred to as unformatted data file.
Each of these functions requires four arguments: a pointer to the data block, the size of the data block, the number of data blocks being transferred, and the stream pointer.
Thus, a typical fwrite function might be written as: fwrite(&customer, sizeof(record), 1, fpt);
Where customer is a structure variable of type record, and fpt is the stream pointer associated with a data file that has been opened for output.
An example program to create an unformatted data file containing customer records:
Reading file:
Displaying the contents: