v05i053: A "safe" replacement for gets()

Guy Harris guy at auspex.UUCP
Fri Nov 18 03:22:12 AEST 1988


>|#define gets(s) fgets(s, sizeof s, stdin)
...
>	gets (s);

>Two problems: the space after gets would kill it if it's a macro,

Say WHAT?  Works fine on all the compilers I know of.  "Preprocessor"
macros don't require that you give the exact same amount of white space
in the invocation as you gave in the definition; if your compiler
requires this, get it fixed!



More information about the Comp.lang.c mailing list