在Visual Studio 2017中编译C ++代码时,我得到以下输出信息:
main.cpp:139:34: warning: format specifies type 'unsigned int *' but the argument has type 'unsigned char *' [-Wformat] sscanf(&item[2 * i], "%02X", &my1ch); ~~~~ ^~~~~~ %2s main.cpp:154:34: warning: format specifies type 'unsigned int *' but the argument has type 'unsigned char *' [-Wformat] sscanf(&item[2 * i], "%02X", &my1ch); ~~~~ ^~~~~~ %2s main.cpp:168:34: warning: format specifies type 'unsigned int *' but the argument has type 'unsigned char *' [-Wformat] sscanf(&item[2 * i], "%02X", &my1ch); ~~~~ ^~~~~~ %2s main.cpp:191:40: warning: flag '0' results in undefined behavior with 's' conversion specifier [-Wformat] printf("[ERROR] START/END IsGreater %064s \n", maxKey.GetBase16().c_str()); ~^~~~ main.cpp:275:26: warning: flag '0' results in undefined behavior with 's' conversion specifier [-Wformat] printf("[load] start=%064s \n", bc->ksStart.GetBase16().c_str()); ~^~~~ main.cpp:276:26: warning: flag '0' results in undefined behavior with 's' conversion specifier [-Wformat] printf("[load] next=%064s \n", bc->ksNext.GetBase16().c_str()); ~^~~~ main.cpp:277:26: warning: flag '0' results in undefined behavior with 's' conversion specifier [-Wformat] printf("[load] end=%064s \n", bc->ksFinish.GetBase16().c_str()); ~^~~~ main.cpp:394:30: warning: flag '0' results in undefined behavior with 's' conversion specifier [-Wformat] fprintf(f, "Priv (HEX): 0x%064s\n", pAddrHex.c_str()); ~^~~~ main.cpp:419:20: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings] lambda.SetBase16("5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72"); ^ main.cpp:420:21: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings] lambda2.SetBase16("ac9c52b33fa3cf1f5ad9e3fd77ed9ba4a880b9fc8ec739c2e0cfc810b51283ce"); ^ main.cpp:572:20: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings] maxKey.SetBase16("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140"); ^ main.cpp:782:29: warning: flag '0' results in undefined behavior with 's' conversion specifier [-Wformat] printf("[keyspace] start=%064s\n", bc->ksStart.GetBase16().c_str()); ~^~~~ main.cpp:783:29: warning: flag '0' results in undefined behavior with 's' conversion specifier [-Wformat] printf("[keyspace] end=%064s\n", bc->ksFinish.GetBase16().c_str());
那它看起来应该怎么样?
到文件内容的链接在这里:https://github.com/JeanLucPons/VanitySearch/blob/master/main.cpp
答案 0 :(得分:2)
转化
以下类型修饰符可以出现在转换中 规格:
h
表示转换将是d,i,o, u,x,X或n,下一个指针是短整数或 unsigned short int(而不是int)。
hh
与h相同,但下一个指针是指向带符号的char或 未签名的字符。
...
=>如果要"%02hhX"
变成"%02X"
,则需要sscanf
而不是unsigned char
。