Tuesday, September 13, 2011

Print alphabet(A-Z) to a file using C

//UVA WELLASSA UNIVERSITY, SRI LANKA
//EDIRISINGHE E.D.M
//14/09/2011

#include<stdio.h>

int main(){    //main function

FILE *fopen(),*fp;//craeting file pointers
int c;

fp=fopen("xxx","w");//open a file for write
//xxx is a file name, user can change it

for(c='A';c<='Z';c++){ //for loop for print
    putc(c,fp);    //print
    }
   
fclose(fp);    //close the file

}    //end of main

No comments:

linkwithin

go