What type does the sscanf Modifier

前端 未结 3 1002
夕颜
夕颜 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 17:50

    As ouah pointed out, these are the same as their lower case counterparts. Why is that? For symmetry with the printf conversion specifiers. Here %x and %X write lowercase or uppercase numbers like deadbeef and DEADBEEF. The symmetry allows to use the same format string for both input with scanf and output with printf.

    #define FMT "%F\n"
    
    sscanf (str, FMT, &value);
    printf (FMT, value);
    

提交回复
热议问题