PDA

View Full Version : scanf



Dave_Sinkula
10-14-2006, 01:15 AM
I'd venture a guess that over 95% of the people who use scanf don't actually know how to use it.

jEssYcAt
10-14-2006, 01:50 AM
I've used it many times, always just mirror a printf() when I use it, and I'm probably missing something. I tend to prefer c++ and std::cin, but that's mainly because I'm lazy. ;)

maxorator
10-14-2006, 02:16 AM
I don't use it because I don't know how to use it correctly...

whiteflags
10-14-2006, 02:52 AM
I'm wondering if this is the place to ask that question. Or if there is any place where you could ask this question at all and get unbiased and fair results.

Frobozz
10-14-2006, 02:55 AM
Well since your question didn't directly indicate the person filling out the poll, I said yes since I'd expect programmers (professional in particular) to know how to use it. I usually use the variants to read data in from a string since I rarely read data from the keyboard using methods that require a carriage return. ;)

twomers
10-14-2006, 03:38 AM
I voted yes, but I've a feeling that there's some kind of twist in what you asked. I know how to basically use it, I would have to look up some of the letters to follow the % signs for different types of variables, but on face value, I believe I do know how to use it.

Why do you think ~5% of people know how to use it?

whiteflags
10-14-2006, 03:43 AM
Twomers:
> I voted yes, but I've a feeling that there's some kind of twist in what you asked. [...]
> I believe I do know how to use it.
Positive thinking!

Dave is generally not a rude person I think, so I doubt he's insulting anyone. If I had to guess though, just recently, someone blindly recommended use of scanf for apparently no reason. And Dave was just so appalled...

Prelude
10-14-2006, 06:16 AM
>I'd venture a guess that over 95% of the people who use scanf don't actually know how to use it.
That's pretty pessimistic. I'd say that most people who know C also know scanf well enough to use it successfully for basic things. When you get into solid, robust usage and advanced features like scansets and read counts, your guess is probably more accurate. I voted no because I consider the ability to safely use scanf important, and I see it very rarely.