Re: A safe scanf function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shriramana Sharma wrote:

> If I am not wrong, a safe alternate for scanf could be (relatively) easily 
> written which simply uses getline and sscanf -- thereby replacing the 
> original scanf function.

You can't /replace/ scanf() in the C library. It's a standard ANSI
function, so it needs to be present and it needs to have its specified
behaviour (which can include consuming either more or less than a line
of input, depending on the format string).

> Why has not anyone written such a function and included it into the GNU C 
> library?

Probably because its trivial to write it yourself if that's what you
really want.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux