Thread: Printing Command

  1. #1
    Daniel Deprose
    Guest

    Printing Command

    what is the command for printing using printer in c programming??
    I'm using borland turbo c++ .
    pls list out the complete command for the printing!
    thank you!!!
    And

    is there any other to generate index no or id by the computer itself???

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    You could always try a search

  3. #3
    Daniel deprose
    Guest
    I tried to search before but none or them match my criteria.
    I want the command to print the file record using printer(hardcopy)

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Code:
    #include <stdio.h>
    
    #define MY_PRINTER_PORT "LPT1" //port for your printer
    
    int main (void){
    
    	char buff[] = "Hello World\n";//catchy text
    
    	FILE *f = fopen(MY_PRINTER_PORT,"w");//open printer as file
    
    	if(!f){
    		printf("Could not open printer for writing");
    		return 1;
    	}
    
    
    	fprintf(f,buff);//write text
    
    	fprintf(f,"%c",(char)12);//write linefeed command
    	
    	fclose(f);//close printer
    	
    	return 0;
    }

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I tried to search before but none or them match my criteria.
    I find that hard to believe, I myself have answered this question (exactly as you asked it) with source code for several methods at least twenty times since I first joined Cprogramming.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 10:43 AM
  2. problem with "touch" command in c program
    By Moony in forum C Programming
    Replies: 10
    Last Post: 08-01-2006, 09:56 AM
  3. printing command.
    By dac in forum C++ Programming
    Replies: 5
    Last Post: 02-25-2006, 01:27 PM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. exe files in -c- language
    By enjoy in forum C Programming
    Replies: 6
    Last Post: 05-18-2004, 04:36 PM