The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-25-2009
mgessner mgessner is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 50
scanf is generally considered unsafe, as is fscanf for similar reasons.

You're much better off learning how to use fgets and sscanf to do your work.

fscanf will continue to read %d from your stream, skipping whitespace and stopping when it can't read another one, so you could have read them in a loop, discarding the ones you didn't want.