|
|
1.1 root 1: #include <stdio.h>
2:
3: #if !defined _MSC_VER && !defined __BORLANDC__
4: char* itoa(int val, char* str, int radix)
5: {
6: switch(radix) {
7: case 8:
8: sprintf(str,"%o",val);
9: break;
10: case 10:
11: sprintf(str,"%u",val);
12: break;
13: case 16:
14: sprintf(str,"%x",val);
15: break;
16: default:
17: sprintf(str,"bad radix: %d",radix);
18: break;
19: }
20: return(str);
21: }
22:
23: char* ltoa(long val, char* str, int radix)
24: {
25: switch(radix) {
26: case 8:
27: sprintf(str,"%lo",val);
28: break;
29: case 10:
30: sprintf(str,"%lu",val);
31: break;
32: case 16:
33: sprintf(str,"%lx",val);
34: break;
35: default:
36: sprintf(str,"bad radix: %d",radix);
37: break;
38: }
39: return(str);
40: }
41:
42: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.