Dear all,
I am fetching a binary file in EBCDIC mode. Well, if I use the code below nothing will bestored in data. But if I do a printf after PerlIO_getc all characters are printed to stdout. What do I wrong?
char data[5000] = { '\0' }; int x; USHORT len;
for(c = 0; c <= len-6; c++) { x = PerlIO_getc(hFile); if(isALPHA((char)x) || isDIGIT((char)x)) { data[c] = ebcdic2ascii[1][x]; } else { data[c] = ' '; } } data[c-1] = '\0';
for(c = 0; c <= len-6; c++)
{
x = PerlIO_getc(hFile);
printf("%c", ebcdic2ascii[1][x]); // here are the characters printed as expected.
if(isALPHA((char)x) || isDIGIT((char)x)) {
data[c] = ebcdic2ascii[1][x];
} else {
data[c] = ' ';
}
}
data[c-1] = '\0';
Thank you, Reinhard