FreePrograms

  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

C Language Tutorial with Free C Programs

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

File I/O : C Language Tutorial

fopen - open a file
fclose - close an open file
fread - read from a file
fwrite - write to a file
fseek/fsetpos - move a file pointer to somewhere in a file.
ftell/fgetpos - file pointer location.

To open a file you need to use the fopen function, which returns a FILE pointer as stated above.

fclose returns zero if the file is closed properly.

Example:-

FILE *fp;
fp=fopen("c:\\new.txt", "w");
fprintf(fp, "New...\n");

© COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM