Study of file i/o - 1 Writing characters to a file with fputc( ).

#include <stdio.h>

int main(void)
{
FILE *fp;
char ch;
fp = fopen("sample" , "w");

if(fp == NULL)
{
printf("\nUnable to create/open file for writing");
return 1;
}

for(ch = 'A' ; ch <= 'Z' ; ch++)
fputc(ch, fp);

fclose(fp);

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin