sprintf_s报错Buffer too small
错误代码:
char output[3]; char ddd = 0x92; sprintf_s(output, 3, "%02x", ddd);
char时0x92转换结果为ffffff92,上述代码改为下面就不会报错
char output[9]; char ddd = 0x92; sprintf_s(output, 9, "%02x", ddd);
或
char output[3]; unsigned char ddd = 0x92; sprintf_s(output, 3, "%02x", ddd);