ack/lang/basic/lib/oct.c

25 lines
352 B
C
Raw Normal View History

#include "bc_string.h"
1984-11-29 14:22:02 +00:00
1985-01-21 12:47:04 +00:00
/* $Header$ */
1984-11-29 14:22:02 +00:00
String *_oct(i)
int i;
{
char buffer[30];
sprintf(buffer,"%o",i);
return( (String *)_newstr(buffer));
}
String *_hex(i)
int i;
{
char buffer[30];
1988-07-01 17:30:06 +00:00
register char *p = buffer;
1984-11-29 14:22:02 +00:00
sprintf(buffer,"%x",i);
1988-07-01 17:30:06 +00:00
while (*p) {
if (*p >= 'a' && *p <= 'f') *p += 'A'-'a';
p++;
}
1984-11-29 14:22:02 +00:00
return( (String *)_newstr(buffer));
}