Friday 7 September 2012

#include <stdio.h>
#include <conio.h>

void main(void)
{
    FILE *fp;
    int num;

    clrscr();
    printf("Program on Reading of a File of Integers\n");
    fp = fopen("three.dat","r");
    if (fp == NULL)
      {
        printf("File Opening Error\n");
        exit(0);
      }
    printf("\nThe available integers are : ");
    while ((num=getw(fp)) != EOF)
         printf("%d ",num);
    fclose(fp);
    printf("\nPress any key to end...");
    getch();
}

No comments:

Post a Comment