input function question

Cory Petkovsek cory at adaptableit.com
Thu Jun 3 11:48:13 PDT 2004


On Thu, Jun 03, 2004 at 07:50:45AM -0700, a person wrote:
> > I'd go like this:
> >
> > char line[1000];
> > ...
> > while(fgets(file,line,999)){
> >   if(sscanf(line,"%d %d %d",&a,&b,&c)!=3)
> >     continue;
> >   //normal processing here
> > }
> 
> Thanks, this seems succint and adequate for the job.

This doesn't retreive all of the values as you wanted.  If there are 4, it will
return 3 and you get only the three values in a,b,c.  If there are 2, it will
return 2 and you get both values.

Cory

-- 
Cory Petkovsek                                       Adapting Information
Adaptable IT Consulting                                Technology to Your
(858) 705-1655                                                   Business
cory at AdaptableIT.com                                  www.AdaptableIT.com



More information about the KPLUG-List mailing list