home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
S
/
SMC21LIB.LZH
/
ITOO.C
< prev
next >
Wrap
Text File
|
2000-06-30
|
640b
|
30 lines
#include stdio.h
/*
** itoo -- convert nbr to octal string of length sz
** right adjusted, blank filled; returns str
**
** if sz > 0 terminate with null byte
** if sz = 0 find end of string
** if sz < 0 use last byte for data
*/
itoo(nbr, str, sz) int nbr; char str[]; int sz; {
int digit;
if(sz>0) str[--sz]=0;
else if(sz<0) sz = -sz;
else while(str[sz]!=0) ++sz;
while(sz) {
digit=nbr&7; nbr=(nbr>>3)&8191;
str[--sz]=digit+48;
if(nbr==0) break;
}
while(sz) str[--sz]=' ';
return str;
}
-sz]=sgn;
while(sz>0) str[--sz]=' ';
return str;
}