What type does the sscanf Modifier

前端 未结 3 1001
夕颜
夕颜 2021-01-25 17:22

I have come across some legacy code that has the following type of line:

sscanf(szBuff,\"%Fd %Ff %Fd %Ff\"

Has anyone seeen a modifier like Fd or Ff? If so, wha

3条回答
  •  臣服心动
    2021-01-25 18:08

    C says for fscanf functions:

    (C991, 7.19.6.2p14) The conversion specifiers A, E, F, G, and X are also valid and behave the same as, respectively, a, e, f, g, and x.

    So in %Fd, the conversion specification is %F which is equivalent to %f. Note that the d is not part of the conversion specification.

    For example (for fprintf functions %F is also the same as %f):

    printf("%fd\n", 3.141592);
    

    will print:

    3.141592d
    


    1. C89/C90 does not recognize the F conversion specifier. For example, for fscanf the corresponding C90 paragraph in 7.9.6.2 says: The conversion specifiers E, G, and X are also valid and behave the same as, respectively e, g, and x

提交回复
热议问题