Monday, August 1, 2011

Create a file containing 26 alphabets(A to Z) in separate lines.

"
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
 FILE *fp;
 int i;
 char *file="c:/sanjay.txt";
 fp=fopen(file,"w");
 if(!fp){
         printf("Issues with file creation, sorry !");
         }
 for(i=1;i<=26;i++)
 {
 
 fprintf(fp,"%c \n",(i+64));
}
fclose(fp);
 getch();
}
"

No comments:

Post a Comment