void MainWindow::loadEBDIC() { txtEdit= new QTextEdit();//setCentralWidget(t); txtEdit->setWindowTitle(tr("EBDIC码")); mdiArea->addSubWindow(txtEdit); txtEdit->show(); //txtEdit->setText(tr("显示EBDIC码:")); QFile file(filename); file.open(QIODevice::ReadOnly); QDataStream EBfile(&file); QString str = tr(""); unsigned char temp = NULL; for( int i = 0; i < 40; i ++) { for( int j = 0; j < 80; j++) { EBfile>>temp; temp=EBCDICtoASCII(temp); //str += QString::fromAscii((const char*)&temp,1); str += QString(temp); } str += tr("\n"); } txtEdit->append(str); file.close(); }
int lib$tra_ebc_asc (void * byte_integer_source_string, void * destination_string) { int sts; sts = str$copy_dx (destination_string, byte_integer_source_string); if ((sts & 1) == 0) return sts; struct dsc$descriptor * dsc = destination_string; int i; char * s = dsc->dsc$a_pointer; for (i=0; i < dsc->dsc$w_length; i++, s++) *s = EBCDICtoASCII(*s); return SS$_NORMAL; }