I want to print *.bmp to a receipt printer. for that I am reading pixel values (hex) inside a loop and then I need to append the read values with the printer command to print then write to the printer. printer api accepts only unsigned char. now I got the pixel values writing to a temp file. How to construct a unsigned char array with printer commands.
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
Any idea How to do this in C?
Thanks in advance for all your help.