[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-users
Subject:    Re: not receiving all the values of VB
From:       Dave Shield <D.T.Shield () csc ! liv ! ac ! uk>
Date:       2002-07-30 12:30:29
[Download RAW message or body]

>  scanf("%s",varbind);

Note that 'scanf("%s", ...)' will only read in *one* token,
not the whole of the varbind line.  From the man page:

   The following conversions are available:

   s      Matches  a  sequence of non-white-space characters;
          the next pointer must be a pointer to char, and the
          array  must  be  large  enough  to  accept  all the
          sequence and the terminating  NUL  character.   The  <===
          input string stops at white space or at the maximum  <===
          field width, whichever occurs first.


You'll probably find it sensible to read in the list of varbinds
a line at a time, using

		gets( varbind );
or (better)
		fgets( varbind, 300, stdin );

Dave

PS:  *PLEASE* - can you not send HTML-formatted mail.  Thank You.



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic