Basic Programs
If Else based Programs
Loop Based Programs
Array Based Programs
String Programs
Function Programs
Pointers Programs
Structure & File Handling Programs
Data Structure Programs
Structure and File Handling programs
File copy program using c
#include <stdio.h> #include <conio.h> void main() { int num; FILE *fp, *fp1; char ch; fp = fopen("test.c","r"); fp1 = fopen("writefile.c","w");
if(fp == NULL) { printf("File not exist"); exit(1); } else { ch=fgetc(fp); while(ch!=EOF) { fputc(ch, fp1); ch=fgetc(fp); } } fclose(fp); fclose(fp1); }
Output of the above program is as following.
Video/ C Introduction
Watch video in full size