
#include <lctype.h> int toebcdic(int i);
toebcdic reduces an integer i to an EBCDIC character by turning
off all bits not stored in a char value.
toebcdic corresponds to the UNIX C compiler function
toascii, which is not meaningful except when ASCII is the native
character set.
toebcdic returns the corresponding EBCDIC character value.
#include <lctype.h>
#include <stdio.h>
main()
{
int i,input;
for(;;) {
puts("Enter an integer (0 to quit)");
scanf("%d", &input);
if (feof(stdin) || input == 0) break;
i = toebcdic(input);
if (isprint(i))
printf("The EBCDIC character for the integer %d is '%c'.n",
input, i);
else
printf("The EBCDIC character for the integer %d is "
"('x%.2x' not printable).n", input, i);
}
}
isebcdic
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.