--- In [email protected], "umkatakam" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "Tamas Marki" <tmarki@> wrote:
> >
> > On 3/16/07, uma mahesh katakam <umkatakam@> wrote:
> > > its like i am working on a code written in c ... so i need da 
> logic in c only i tried using getw and fscanf .. but :( dint 
> work ....
> > 
> > Why don't you show us the code?
> > 
> > -- 
> > Tamas Marki
> >
> #include<stdio.h>
> #include<conio.h>
> void main()
> {
>       FILE *fp;
> 
> 
> 
>       int x ;
>        fp = fopen( "even.txt","r+");
>   //    fscanf(fp,"%d",&x);
>       do
>       {
>               x = getw(fp);
>             printf("%d",x);
> 
>       }while(x!=EOF)
> 
>       getch();
> 
> 
> 
> 
> }
> 
> this is da code .... it aint retuning me the actual inegers ... my 
> even.txt file has a few integers in order for ex : 1 2 3 4 5
>


What kind of file are you working with - text or binary?

You need to choose the correct functions for the file type -
getw() is used to read a word from a binary file. If used on a text
file results will not be whats expected.

Also you can remove the header conio.h. its not necessary.


Mickey




Reply via email to