Chapter:

Data-Files

Write C program to copy contents of one file to anor file.

include <stdio.h> 

#include <stdlib.h> // For exit() 

void main() 

    FILE *fptr1, *fptr2; 

    char filename[100], c; 

    printf("Enter the filename to open for reading \n"); 

    scanf("%s", filename); 

    // Open one file for reading 

    fptr1 = fopen(filename, "r"); 

    if (fptr1 == NULL) 

    { 

        printf("Cannot open file %s \n", filename); 

        exit(0); 

    } 

    printf("Enter the filename to open for writing \n"....

Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-