Wednesday, September 9, 2009
Write a c program to write text in the file
#includevoid main(){ FILE *p; char str[70]; if((p=fopen("string.txt","w"))==NULL) { printf("\nUnable to open file string.txt"); exit(1); } else printf("\nEnter a set of strings,Press just enter key to finish\n: "); while(strlen(gets(str))>0) { fputs(str,p); fputs("\n",p); } fclose(p); getch();}
Labels:
File Handling
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment