top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How we can print a string on the printer in C?

+1 vote
382 views
How we can print a string on the printer in C?
posted Mar 30, 2015 by Amit Kumar Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I don't know whether i am on right path but this may help..

Linux provides a program called lpr that accepts standard input and sends it to the printer.

Ex:
cat poorly_formatted_report.txt | fmt | pr | lpr

we use cat to read the file and output it to standard output, which is piped into the standard input of fmt. fmt formats the text into neat paragraphs and outputs it to standard output, which is piped into the standard input of pr. prsplits the text neatly into pages and outputs it to standard output, which is piped into the standard input of lpr. lpr takes its standard input and sends it to the printer.

answer Apr 2, 2015 by Chirag Gangdev
Similar Questions
+5 votes

Can we realloc a string inside a structure?

struct info
{
     char name[20];
     int age;
     char address[20];
}; 

struct info d[10];

I want to realloc name, how can I do it?

0 votes

I want to write some C code where I want to print a string say "Hello World" but don't want to use semicolun(;), how can I achieve that.

...