toebcdic -- Reduce Integer to EBCDIC Character

SYNOPSIS

 #include <lctype.h>

 int toebcdic(int i);
 

DESCRIPTION

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.

RETURN VALUE

toebcdic returns the corresponding EBCDIC character value.

EXAMPLE

  #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);
     }
  }

 

RELATED FUNCTIONS

isebcdic

SEE ALSO

Character Type Macros and Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.