// // Programmer: Craig Stuart Sapp // Creation Date: Tue Dec 9 21:10:17 PST 1997 // Last Modified: Tue Jan 27 21:23:19 GMT-0800 1998 // Filename: ...sig/doc/examples/improv/improv/todec/todec.cpp // Syntax: C++; improv // $Smake: cc -o %b %f -lg++ && strip %b // $Smake-linux: g++ -o %b %f && strip %b // #include #include #include #include #include int atohd(const char* aNumber); void exitUsage(const char* command); int main(int argc, char* argv[]) { if (argc != 2) exitUsage(argv[0]); int aValue; aValue = atohd(argv[1]); cout << aValue << endl; return 0; } int atohd(const char* aNumber) { return (int)strtol(aNumber, (char**)NULL, 0); } void exitUsage(const char* command) { cout << endl; cout << "Converts an integer into decimal form.\n"; cout << endl; cout << "Usage: " << command << " integer" << endl; cout << endl; cout << " integer = [-0x80000000..0x7fffffff] \n"; cout << " [-2147483648..2147483647] \n"; cout << endl; exit(1); }