* .bmp를 영수증 프린터로 인쇄하려고합니다. 루프 내에서 픽셀 값 (16 진수)을 읽고 프린터 값을 프린터 명령에 추가하여 인쇄 한 다음 프린터에 씁니다. 프린터 API는 unsigned char
만 허용합니다. 이제 픽셀 값을 임시 파일에 기록합니다. 프린터 명령으로 unsigned char
배열을 구성하는 방법.런타임시 부호없는 char 배열에 값 추가
unsigned char printcommand [] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67 };
int len=sizeof(printcommand)/sizeof(unsigned char);
printf("Length Of Array=%d\n", len);
result = C56_api_printer_clear (iPrinter);
/*----------READ RASTER DATA----------*/
for(r=0; r<=originalImage.rows - 1; r++) {
for(c=0; c<=originalImage.cols - 1; c++) {
/*-----read data and print in (row,column) form----*/
fread(pChar, sizeof(char), 1, bmpInput);
// here instead of writing to file i need to append to printercommand[]
fprintf(rasterOutput, "0x%x,", *pChar);
}
// here i need to write to the printer as C56_api_printer_write(iPrinter, printcommand, sizeof(printcommand), 1000);
fprintf(rasterOutput, "\n");
}
// close the printer
모든 아이디어 어떻게 C 에서이 작업을 수행 할 수 있습니까?
미리 도움 주셔서 감사합니다.
안녕 Aslai는 문자 배열은 픽셀 값을 포함하지 않을뿐만 아니라, 그것은 프린터 특정 명령을 시작해야합니다. 'Cmd + Row 1 => [1B CD 38 08 00 01 02 09 0 ....], Cmd + Row 2 => [1B CD 38 08 02 03 01 0A 0C ...]. 내가 사용하고있는 비트 맵 크기는 256x256입니다. – san
모든 명령의 길이가 일정합니까? 그리고 당신이 필요로하는 행 승진 이외의 것이 있습니까? – Kaslai
네 버디, 처음 네 바이트'[1B CD 38 08]'명령입니다. 프린터 버퍼에 쓰기 전에이 명령으로 행 데이터를 추가해야합니다. 그게 다야. – san