-->
Showing posts with label program to read that stored integers using getw. Show all posts
Showing posts with label program to read that stored integers using getw. Show all posts

program to read that stored integers using getw

using codeblocks
-----------------------------------------------------------------------------
#include <stdio.h>
int main()
{
    FILE *p;                               //pointer declaration
    char ch;
p=fopen("data1.txt","r");               // openes the file in read only mode
    while((i=getw(p))!=EOF)              //read an  integer using getw from opened file.
    {

        printf("%d,",i);                //prints that integer on screen
    }
    fclose(p);                            //closes the file
    return 0;
}

----------------------------------------------------------------------------------------
using turboc++
-----------------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include<conio.h>
int main()
{
    FILE *p;                               //pointer declaration
    char ch;
p=fopen("data1.txt","r");               // openes the file in read only mode
    while((i=getw(p))!=EOF)              //read an  integer using getw from opened file.
    {

        printf("%d,",i);                //prints that integer on screen
    }
    fclose(p);                            //closes the file
    getch();
    return 0;
}