Annotation of coherent/a/usr/man/ALL/sscanf, revision 1.1.1.1

1.1       root        1: 
                      2: 
                      3: sscanf()                      STDIO                      sscanf()
                      4: 
                      5: 
                      6: 
                      7: 
                      8: Format a string
                      9: 
                     10: #include <stdio.h>
                     11: iinntt ssssccaannff(_s_t_r_i_n_g, _f_o_r_m_a_t [, _a_r_g ] ...)
                     12: cchhaarr *_s_t_r_i_n_g; cchhaarr *_f_o_r_m_a_t;
                     13: 
                     14: sscanf reads  the argument string,  and uses format  to specify a
                     15: format for each  arg, each of which must be  a pointer.  For more
                     16: information on sscanf's conversion codes, see scanf.
                     17: 
                     18: ***** Example *****
                     19: 
                     20: This example  uses sspprriinnttff to create a string,  and then reads it
                     21: with  ssssccaannff.  It  also illustrates  a  common problem  with this
                     22: routine.
                     23: 
                     24: 
                     25: #include <stdio.h>
                     26: 
                     27: main()
                     28: {
                     29:         char string[80];
                     30:         char s1[10], s2[10];
                     31: 
                     32: 
                     33: 
                     34:         sprintf(string, "123456789012345678901234567890");
                     35:         sscanf(string, "%9c", s1);
                     36:         sscanf(string, "%10c", s2);
                     37: 
                     38: 
                     39: 
                     40:         printf("\n%s is the string\n", string);
                     41:         printf("%s: first 9 characters in string\n", s1);
                     42:         printf("%s: first 19 characters in string\n", s2);
                     43: }
                     44: 
                     45: 
                     46: ***** See Also *****
                     47: 
                     48: fscanf(), scanf(), STDIO
                     49: 
                     50: ***** Diagnostics *****
                     51: 
                     52: sscanf returns  the number of arguments  filled.  It returns zero
                     53: if no arguments can be filled or if an error occurs.
                     54: 
                     55: ***** Notes *****
                     56: 
                     57: Because C does not  perform type checking, an argument must match
                     58: its format  specification.  sscanf is  best used only  to process
                     59: data that you are certain are in the correct data format, such as
                     60: data that were written with sprintf.
                     61: 
                     62: 
                     63: 
                     64: COHERENT Lexicon                                           Page 1
                     65: 
                     66: 
                     67: 
                     68: 
                     69: sscanf()                      STDIO                      sscanf()
                     70: 
                     71: 
                     72: 
                     73: sscanf  is difficult  to use correctly,  and incorrect  usage can
                     74: create serious  bugs in programs.  It  is recommended that strtok
                     75: be used instead.
                     76: 
                     77: 
                     78: 
                     79: 
                     80: 
                     81: 
                     82: 
                     83: 
                     84: 
                     85: 
                     86: 
                     87: 
                     88: 
                     89: 
                     90: 
                     91: 
                     92: 
                     93: 
                     94: 
                     95: 
                     96: 
                     97: 
                     98: 
                     99: 
                    100: 
                    101: 
                    102: 
                    103: 
                    104: 
                    105: 
                    106: 
                    107: 
                    108: 
                    109: 
                    110: 
                    111: 
                    112: 
                    113: 
                    114: 
                    115: 
                    116: 
                    117: 
                    118: 
                    119: 
                    120: 
                    121: 
                    122: 
                    123: 
                    124: 
                    125: 
                    126: 
                    127: 
                    128: 
                    129: 
                    130: COHERENT Lexicon                                           Page 2
                    131: 
                    132: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.