Reading Writing a Integer from a file || File handling || C programming
In this, we are going to see a program to write and read an Integer from a file with the help of C Programming Language.

 


#include <stdio.h>

void main()
{
    FILE *fptr;
    int a;
    printf(" Enter any number: ");
    scanf("%d", &a);

    fptr = fopen("sample.txt", "w");
    putc(a, fptr);

    fclose(fptr);

    fptr = fopen("sample.txt", "r");
    a = getc(fptr);

    printf("Number: %d", a);
}

//.....coded by ANANYA MAURYA

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post