Right, here's another version.  Could you please have another read
through, Stephane

   NOTES
       The GNU C library supports a non-standard extension that causes
       the library to dynamically allocate a string of sufficient size
       for  input  strings  for  the  %s  and   %a[range]   conversion
       specifiers.  To make use of this feature, specify a as a length
       modifier (thus %as or %a[range]).  The caller must free(3)  the
       returned string, as in the following example:

           char *p;
           int n;

           errno = 0;
           n = scanf("%a[a-z]", &p);
           printf("n=%d, errno=%d\n", n, errno);
           if (n == 1) {
               printf("read: %s\n", p);
               free(p);
           } else if (errno != 0) {
               perror("scanf");
           } else {
               fprintf(stderr, "No matching characters\n"):
           }

       As  shown  in  the  above example, it is only necessary to call
       free(3) if the scanf() call successfully read a string.

       The a modifier is not available if the program is compiled with
       gcc  -std=c99  or  gcc  -D_ISOC99_SOURCE (unless _GNU_SOURCE is
       also specified), in which case the a is interpreted as a speci-
       fier for floating point numbers (see above).

       Since  version  2.7, glibc also provides the m modifier for the
       same purpose as the a modifier.  The m modifier has the follow-
       ing advantages:

       * It  may  also  be  applied to %c conversion specifiers (e.g.,
         %3mc).

       * It avoids ambiguity with respect  to  the  %a  floating-point
         conversion specifier (and is unaffected by gcc -std=c99 etc.)

       * It is specified in the upcoming revision of the POSIX.1 stan-
         dard.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to