CCCCCCCCCCCCCCCCC

Thursday, 13 February 2020

C program to write and read the characters in upper letter in file:

#include<stdio.h>
#include<string.h>
void main()
{
    FILE*fp;
    char ch[10];
    fp=fopen("upper.txt","w");
    printf("\nEnter the characters:");
    scanf("%s",&ch);
    putc(strupr(ch),fp);
    fclose(fp);

    printf("\nThe ch from file are:");
    fp=fopen("upper.txt","r");
    while((ch=getc(fp))!=EOF)
        putc(ch);
    fclose(fp);

}

No comments:

Post a Comment