Re: C code... file reading(twice)... strange problem!

Rohit Kumar <rohitsz2-/[email protected]> Wed, 23 Mar 2005 11:59:30 -0800 (PST)
Newsgroups gmane.user-groups.linux.delhi.devel
Message-ID <[email protected]>
Greetings again,

everything is working now...
 
> > > > 			for(i=0;i<n;i++)
> > > > 			{/* fread reads same value every time!*/
> > > > 				fread(&val,sizeof(long),1,fp);
> > >                                   ^^^^
> > > First, you want just "val" here. Second, val is
> uninitialised here,
> > > so this code just won't work. Try making val
> actually point to
> > > something.
> > 
> > done this too...(i can't understand, why to make
> val
> > point to something..? i am reading anything before
> > writing something in it!)
> 
> Huh? val must point to valid storage for
> 1*sizeof(long) bytes for fread
> to work.

well sorry for such a silly doubt. now by allocating
space to val things are working fine!

i am able to write/read/retreive about one lakh
numbers thru file. this was the aim when i started
writing the code...

thanks a lot for your help :-)

thanks & regards,
rohit.

NAMASTE, i honour the spirit in you which is also in me.
```````````````````````````````````````````````````````
http://www.geocities.com/rohitsz2

|Anytime you feel i need to understand| 
|a concept before i am eligible to get|
|an answer i would be happy to know.  |
^*************************************^

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com