priting the integers is my task i have to read the integers from the 
file one by one and pass each integer into another function ... so i 
have to read them as integers one by one ....
 x = read the first/next integer from the file 
 y =  function(x);
 print(x);
this is wht i want .... and i want this loop to run until the end of 
the file






--- In [email protected], Amit Petkar <[EMAIL PROTECTED]> wrote:
>
>  FILE *fp;
>  int x ;
>  fp = fopen( "c:\\test.txt","r+");
>  // fscanf(fp,"% d",&x);
>  do
>  { 
>   char str[50];
>   for(int i=0;;i++)
>   {
>    x = fgetc(fp);
>    if(x != ' ' && x!=EOF)
>     str[i] = x;
>    else
>    {
>     str[i] = '\0';
>     break;
>    }   
>   }  
>  printf("%s", str);
>    }while(x!=EOF);
> 
> 
> 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
> 
> 
> 
>          
> 
> 
> Amit D. Petkar
> Member Of Techinical Staff    
> Persistent Systems Pvt. Ltd. 
> 'Bhageerath', 402,
> Senapati Bapat Road, 
> Pune- 411 016. INDIA.
>  [EMAIL PROTECTED] 
>  tel  : +91 (20)25602749
>  fax  : +91 (20) 25678901
>  mobile: +91 9822345538
>                               
> ---------------------------------
>  Here's a new way to find what you're looking for - Yahoo! Answers 
> 
> [Non-text portions of this message have been removed]
>


Reply via email to