• Jiri Popelka's avatar
    use scanf("%ms") instead of scanf("%as") for dynamic string · 53c40178
    Jiri Popelka authored
    from scanf(3):
    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 specifier 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 following
    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 standard.
    53c40178
ddp_gr.c 2.69 KB