Tag Archives: file

Write an interactive C program to append the contents of a file at the end of another file without using any built-in functions – IGNOU MCA Assignment 2017 – 18

MASTER OF COMPUTER APPLICATIONS Course Code: MCS-011 Course Title : Problem Solving and Programming Assignment Number : MCA(1)/011/Assign/2017-18 Maximum Marks : 100 Write a program to find the largest element in an array using Recursion – IGNOU MCA Assignment 2017 – 18 Program: #include<stdio.h> #include<stdlib.h> void main() { FILE *fp1,*fp2,*ftemp; char CH; int c; clrscr();… Read More »

Write a Program in ‘C’ to copy one file to another. The program should read the filenames at command line. 10m Jun2009

Write a Program in ‘C’ to copy one file to another. The program should read the filenames at command line. 10m Jun2009 Code: #include<stdio.h> int main(int argc,char *argv[]) { FILE *fs,*ft; int ch; if(argc!=3) { printf(“Invalide numbers of arguments.”); return 1; } fs=fopen(argv[1],”r”); if(fs==NULL) { printf(“Can’t find the source file.”); return 1; } ft=fopen(argv[2],”w”); if(ft==NULL)… Read More »

Write a program to read formatted data from the file. 6m Jun2008

Write a program to read formatted data from the file. 6m Jun2008 CODE:- #include<stdio.h> void main() { int account; char name[30]; double bal; FILE *fp; if((fp=fopen(“data.txt”,”r”))== NULL) printf(“FILE not present \n”); else do{ fscanf(fp,”%d%s%lf”,&account,name,&bal); if(!feof(fp)) { if(bal==0) printf(“%d %s %lf\n”,account,name,bal); } }while(!feof(fp)); getch(); } [codesyntax lang=”c”] #include<stdio.h> void main() { int account; char name[30]; double… Read More »

Write a program in ‘C’ language that accepts the name of a file as input and prints those lines of the file which have the word ‘this’. 10m Dec2007

Write a program in ‘C’ language that accepts the name of a file as input and prints those lines of the file which have the word ‘this’. 10m Dec2007    #include<stdio.h> void main() { FILE *fp; int cnt=0; char str[80],lines[400]; clrscr(); if ((fp=fopen(“test.txt”,”r”))== NULL) { printf(“File does not exist\n”); exit(0); } while(!(feof(fp))) { fgets(str,80,fp); if(strcmp(“this”,str))… Read More »

Write a program to count the number of characters and words in a given file. 10m Jun2007

Write a program to count the number of characters and words in a given file. 10m Jun2007  #include<stdio.h> #include<process.h> void main() { FILE *fp; int chr=0,wrd=1,str; clrscr(); if((fp=fopen(“test.txt”,”r”))== NULL) { printf(“File does not exist\n”); exit(0); } while(!(feof(fp))) { str=fgetc(fp); if(str==’ ‘) wrd++; chr++; } printf(“The number of characters in file :%d\n”,chr); printf(“The number of words… Read More »

A C program to covert decimal to binary, octal & Hexadecimal – IGNOU MCA Assignment 2013

MASTER OF COMPUTER APPLICATIONS Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment Number : MCA(1)/011/Assign/13 Assignment 2013   A C program that takes a decimal number and converts it into binary, octal and hexadecimal equivalents. Your program should have functions for each type of conversion. These functions should implement algorithms to… Read More »