1

How can we print file contents on printer in python?Is there ,something like C's stdprn in python?

#include<stdio.h>
#include<stdlib.h>
int main()
{
  FILE *fp;
  char ch;
  fp=fopen("poem.txt","r");
  while((ch=fgetc(fp))!=EOF)
      fputc(ch,stdprn);
  fclose(fp);
  return 0;
}
user3223301
  • 201
  • 4
  • 11
  • From here [How do you write to the printer ?](https://mail.python.org/pipermail/python-list/2009-January/518851.html): A printer is nothing Python has or controls, it is a standard thing for a computer system, so details about your computing environment are necessary in order to give you good advice. – Grijesh Chauhan Feb 02 '14 at 09:35
  • 1
    C doesn't have `stdprn` either; it's a nonstandard extension from the days of MS-DOS. – user2357112 Feb 02 '14 at 09:36
  • Googled it. I don't think Python has anything built-in for interacting with printers; the simplest example I found delegated to the `lpr` program to do the job. – user2357112 Feb 02 '14 at 09:45
  • possible duplicate of [Print to standard printer from Python?](http://stackoverflow.com/questions/12723818/print-to-standard-printer-from-python) – user2357112 Feb 02 '14 at 09:45

0 Answers0