Chapter Contents

Previous

Next
toebcdic

toebcdic



Reduce Integer to EBCDIC Character

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


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


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.