帮帮忙呀,我用的是老美的NCR Pos机子,文档上的例子是用C写得,但是在C++Builder、delphi好像不适合.
谁能把它转成适合BCB或者delphi用的? #include
#include
#include
#include
#include
#include #define CR 13
#define ESC 27
union REGS regs ;
char title[] = "\n\n VFD Testing Program " ;
char line1[] = "\n Comport Select 1:Com1 2:Com2 3:Com3 4:Com4 6:Com6 Esc:Quit :" ;
char line2[] = "Test Prog 8/ 1/2000\n" ;
char low_line[] = "Send string to line2\n" ;
char fix_p[] = "0K2000, 25000\n" ;
char string[] = "DemoProgramm";
char string2[] = "Welcome !!2003/06/29";
unsigned ComPort,count,ComSelect;
unsigned Status,j,k,c,d,ch,chold;
void main()
{
unsigned data ;
char *ComData;
int tempLoop;
unsigned char charcount1,charcount2;
ProgramStart:
clrscr();
printf(title);
printf(line1);
ComPort_Select:
ComSelect=getch();
switch(ComSelect){
case('1'): ComPort=0;ComData="Now = COM1,9600,N,8,1 "; break;
case('2'): ComPort=1;ComData="Now = COM2,9600,N,8,1 "; break;
case('3'): ComPort=2;ComData="Now = COM3,9600,N,8,1 "; break;
case('4'): ComPort=3;ComData="Now = COM4,9600,N,8,1 "; break;
case('6'): ComPort=5;ComData="Now = COM6,9600,N,8,1 "; break;
case(ESC): goto programmend;break;
default: printf("\n Error!!");cur_homeB(); goto ComPort_Select; break;
}
charcount1=0;
charcount2=0;
ch = 1;
data = _COM_CHR8|_COM_STOP1|_COM_NOPARITY|_COM_9600;
_bios_serialcom(_COM_INIT, ComPort , data) ;
cur_homeA();
printf("\n Press any key to show (F10 to quit) ");
printf(ComData);
printf("\n \n");
do
{
if(kbhit()) //check if hit any key
{
c=getch();
if (c==68 && d==0)
goto programmend;
printf("\n Input Data ==== %d ==== %c",c,c);
_bios_serialcom(_COM_SEND,ComPort,c);
} }
while(1);
programmend:
}
cur_home()
{
regs.h.ah = 2;
regs.h.bh = 0;
regs.h.dh = 5;
regs.h.dl = 0;
int86(0x10, ®s, ®s) ;
return 0;
}
cur_homeA()
{
regs.h.ah = 2;
regs.h.bh = 0;
regs.h.dh = 2;
regs.h.dl = 0;
int86(0x10, ®s, ®s) ;
return 0;
}
cur_homeB()
{
regs.h.ah = 2;
regs.h.bh = 0;
regs.h.dh = 3;
regs.h.dl = 66;
int86(0x10, ®s, ®s) ;
return 0;
}
先谢谢了! =========================
向各位網友學習