【发布时间】:2010-09-25 23:25:55
【问题描述】:
typedef union
{
uint ui[4];
} md5hash;
void main(void)
{
int opt;
while ((opt = getopt(argc, argv, "c:t:s:h:")) != -1) {
switch (opt) {
case 'h':
hash = optarg;
break;
default: /* '?' */
exit(EXIT_FAILURE);
}
}
md5hash hash;
sscanf(hash, "%x%x%x%x", &hash.ui);
}
./program -h ffffffffffffffffffffffffffffffff
我想做上面的,但是sscanf没有正确接受md5sum...
【问题讨论】:
-
你应该阅读 sscanf 的手册页。它解释了所有格式说明符和东西。
-
请注意,“main”返回 int。总是。它永远不会返回 void。