Once you have a translate table, then you simply index into the table. (exactly what the ctype functions do). The work is building the translate table. The IBM mainframe OSs used to have them built in because many of the devices were ASCII. More specifically, the table itself is a character array (or unsigned int array) containing 256 elements. Assuming the array is atoe: To convert: int c; int ebc; while((c = getchar()) != EOF) { ebc = atoe[c]; putc(ebc, ebcidic_file); } On 30 May 2002 at 16:31, Jesse Marlin Jesse Marlin wrote:
François Pinard writes:
[Jesse Marlin]
Here is something that I have found. It uses a simple table lookup to convert an entire buffer. We also have a swedish to ebcdic as well.
static unsigned char const latin1_to_ebcdicus[256] = [...]
Looks much like the output of "recode -h latin1..ebcdicus"... :-)
Might be, it is a function we use at work which was probably scraped from somewhere.
-- François Pinard http://www.iro.umontreal.ca/~pinard
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com
-- Jerry Feldman Enterprise Systems Group Hewlett-Packard Company 200 Forest Street MRO1-3/F1 Marlboro, Ma. 01752 508-467-4315 http://www.testdrive.compaq.com/linux/