Tuesday, June 06, 2006
scanf
For the first time since I learned C 18 years ago I noticed that the standard library function scanf (and friends) has been enhanced with many new formats and features.
E.g., the following code
scanf ("%s %[^\n]\n", name, args);
reads a "word" from the input (and assigns it to name) and then reads the rest of the line till end-of-line, irrespective of spaces and other symbols, and assigns it to args.
Very detailed description of scanf formats is available at Solaris 10 Reference Manual Collection pages.
There is also a brief introduction to the standard C library here. Wikipedia, as usual, has a worthy collection of links as well.
Labels: C