版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
#include#includeint main(int argc, char *argv[]) { if (argc != 2){ printf("usage: ./exe number_string\n"); } const char *num_str = argv[1]; unsigned long num = strtoul(num_str, NULL, 10); printf("%lu ==> %ld\n", num, (signed long)num); return 0; }
用gcc3.4.5编译。