EBCDIC files

This is a discussion on EBCDIC files within the C Programming forums, part of the General Programming Boards category; I am dealing with ASCII and EBCDIC files within my program. I need to be able determine (from within my ...

EBCDIC files

I am dealing with ASCII and EBCDIC files within my program. I need to be able determine (from within my program) if a file is EBCDIC, then convert it to ASCII. I have the conversion routine, but I need to be able to tell if a file is EBCDIC. Any ideas?

I have looked at a couple of hex dumps of EBCDIC files. So far both files start out with the following characters:

[abbreviation, Extended Binary Coded Decimal Interchange Code] An alleged character set used on IBM dinosaurs. It exists in at least six mutually incompatible versions, all featuring such delights as non-contiguous letter sequences and the absence of several ASCII punctuation characters fairly important for modern computer languages (exactly which characters are absent varies according to which version of EBCDIC you're looking at). IBM adapted EBCDIC from punched card code in the early 1960s and promulgated it as a customer-control tactic (see connector conspiracy), spurning the already established ASCII standard. Today, IBM claims to be an open-systems company, but IBM's own description of the EBCDIC variants and how to convert between them is still internally classified top-secret, burn-before-reading. Hackers blanch at the very name of EBCDIC and consider it a manifestation of purest evil. See also fear and loathing.