Wednesday, January 14, 2009

Program description: The following program will copy data from a file. This program will take two string as input. First String is the name of the file with address which you want to copy and second string is the name of the output file with address. suppose your first input is c:\tc\asci.txt.This input means that you want to copy a text file named asci which is in the tc folder of c drive. your second string may be d:\abc\copyasci.txt. This means that after copying the file asci.txt you will save it in the folder abc of d drive in the name copyasci. program code: #include #include #include void main() { clrscr(); char s,str1[50],str2[50]; printf("Enter a file name:"); gets(str1); printf("Enter out put file:"); gets(str2); FILE *fp,*fo; fp=freopen(str1,"r",stdin); fo=freopen(str2,"w",stdout); while((s=getc(fp))!=EOF) { if(islower(s)) putc(toupper(s),fo); } fclose(fp); fclose(fo); } OUTPUT OF THE PROGRAM:If you run the program your input will be the following.

0 comments:

Visitors

PlugIn.ws - Free Hit Counter, Web Site Statistics, Traffic Analysis

  © Blogger template Leaving by Ourblogtemplates.com 2008

Back to TOP