Write a program which will write 10 integer numbers stored in an integer array to a data file called NUMBERFILE. The program will then close this file, and reopen it to display by reading the NUMBERFILE

#include<stdio.h>
#include<STDLIB.H>
#include<conio.h>
main()
{
    int a[10],i;
    FILE *f2;

    for(i=0;i<=9;i++)
        scanf("%d",&a[i]);

    f2=fopen("NUMBERF.txt","w");

    for(i=0;i<=9;i++)
        putw(a[i],f2);

    fclose(f2);


    f2=fopen("NUMBERF.txt","r");
    while((i=getw(f2)) != EOF)
        printf("%d  ",i);

    fclose(f2);

    getch();

}
Next Post Previous Post
No Comment
Add Comment
comment url