home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
utils
/
sysutl
/
probe102.lbr
/
ASCTOBIN.CZ
/
ASCTOBIN.C
Wrap
Text File
|
1986-12-28
|
1KB
|
39 lines
/******************************************************************************/
/* asciitobin(ch,str) */
/* Copyright (c) 1984 by Paul M. Sittler */
/******************************************************************************/
#define EOS 0x00
asciitobin(ch,str) /* converts ascii character ch to a 9-character */
/* binary encoded string in the form of */
/* 0100 1011 */
/******************************************************************************/
/* calling parameters */
/******************************************************************************/
char ch; /* ascii character passed with function call */
char *str; /* pointer to 9 character binary encoded ascii string */
{
/******************************************************************************/
/* local variables */
/******************************************************************************/
int bin_ch;
for (bin_ch = 0; bin_ch < 9; bin_ch++)
{
if (bin_ch == 4)
str[bin_ch++] = ' ';
(ch & 0x80) ? str[bin_ch] = '1' : str[bin_ch] = '0';
ch <<= 1;
}
str[9] = EOS;
}
*********************