0

What is the correct way print file to printer from C -program?

Command system("lpr /tmp/filename.prn"); generates error lpr: No file in print request.

Same command in command line works perfectly.

OS is Debian 9.2, kernel 4.9.0 and cups is version 2.2.1-8

melpomene
  • 84,125
  • 8
  • 85
  • 148
  • 1
    Out of curiosity, I googled "c printer linux". (I didn't try "print" as you can imagine.) My first hit was [Printing from a C program in linux - Google Groups](https://groups.google.com/forum/#!topic/comp.os.linux.development.apps/3VkXE2UlpHQ). I believe you will find an appropriate answer there. – Scheff's Cat Nov 19 '17 at 13:33
  • Many thanks! I found solution following link you provided. It was a problem with quoting chars. Correct code is: system( "lpr \"/tmp/filename.prn\""); "\ does the job. – user8587396 Nov 19 '17 at 14:49

0 Answers0