input function question

Gabriel Sechan gsechan at hotmail.com
Sat Jun 5 18:59:36 PDT 2004




>From: Cory Petkovsek <cory at adaptableit.com>

>You are right, I miswrote.  It is printf and friends that will segfault (on
>some platforms in some cases) if given an improper mix of tokens and
>variables.  (ie printf("%d %d\n", a); )  On other platforms and in other 
>cases
>it will just print invalid goo.  On my solaris box with gcc and a tiny 
>program,
>it printed this: 3 -13376040.  I have seen printf segfault in similar 
>cases,
>compiled with gcc.
>
You can get scanf to segfault like that if you go scanf("%d %d\n",&a)  
without a storage place for the second variable.  In fact, its FAR more 
likely to segfault than printf.

Gabe

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963




More information about the KPLUG-List mailing list