Home > Back-end >  Sscanf () without the field width limits can crash with help from the input data.
Sscanf () without the field width limits can crash with help from the input data.

Time:09-19

Who to tell me something about sscanf this warning what do you mean how to change? I am the understanding is not very thorough,

 
Sscanf (buf, "% * [^ & lt;] <[% ^ & gt;]>" , iniDefaultPlate);
Sscanf (buf, "& lt; [% ^ & gt;]>" , _platecolor [I]. Color);
Sscanf (buf, "& lt; [% d | % ^ & gt;]>" , & amp; M [I] No, m [I] Code);

CodePudding user response:

This is read in the data may be greater than your save data memory space of the variables of
If Windows can use the sscanf_s finally add a length parameter

CodePudding user response:

Through sscanf () function to write the content in the character array buf, the need to specify the size of the writing, otherwise, when the content of writing than buf, will produce overflow,
 char name [100]. 
Fscanf (wp, "% 99 s", name);

At this time, you need to specify the width of the write 99,
  • Related