Thread: Printer

  1. #1
    Gerard Fremaint
    Guest

    Printer

    Is there a way for me to print to the printer with C Programming in DOS ?

  2. #2
    Registered User Unimatrix139's Avatar
    Join Date
    Jun 2002
    Posts
    55

    Ports

    I'm not exactly a C wizard, and I can't program using ports. I'd write all the data to a file and use:-

    Code:
    system("copy file.ext prn");
    or
    Code:
    system("type file.ext >prn");
    Basically this is getting DOS to do the work for you. And if you aren't using pure DOS (Running COMMAND.COM under Windoze) I'm not sure Windoze will like it.
    Kree'ta Tau'ri! Chaapa'ai!

  3. #3
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946

    Re: Ports

    Originally posted by Unimatrix139
    I'm not exactly a C wizard, and I can't program using ports. I'd write all the data to a file and use:-

    Code:
    system("copy file.ext prn");
    or
    Code:
    system("type file.ext >prn");
    Basically this is getting DOS to do the work for you. And if you aren't using pure DOS (Running COMMAND.COM under Windoze) I'm not sure Windoze will like it.
    i don't know if those particular commands are valid, but printing to the printer using dos stuffs under windoze 98 works for me.
    hello, internet!

  4. #4
    Seven years? civix's Avatar
    Join Date
    Jul 2002
    Posts
    605
    I once heard that you need to write to drivers, otherwise, im not the best person to ask.
    .

  5. #5
    Registered User Dr. Bebop's Avatar
    Join Date
    Sep 2002
    Posts
    96
    There are a bunch of ways in DOS, here are two
    Code:
    #include <stdio.h>
    main()
    {
    	fprintf( stdprn, "Something to print\n" );
    }
    
    #include <stdio.h>
    main()
    {
    	FILE *stream;
    	
    	stream = fopen( "PRN", "w" );
    	fprintf( stream, "Something to print\n" );
    }
    Bebop
    Processing error: Stupidity detected.
    ------------------------------
    Dr. Bebop
    Windows XP Professional Ed.
    Microsoft Visual Studio 6

  6. #6
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    Deosn't work with USB printers though

  7. #7
    ???
    Guest
    >> Deosn't work with USB printers though

    change "PRN" to "LPT1".

  8. #8
    Registered User Unimatrix139's Avatar
    Join Date
    Jun 2002
    Posts
    55

    Port definitions

    LPT1 and PRN are pretty much identical - LPT1 is the id for Parallell port 1 and PRN is the default parallell port (almost always LPT1) - Anyway, I don't think you can address LPT1 from C with fprintf, etc.
    Kree'ta Tau'ri! Chaapa'ai!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Set Printer Prior To Loading Print Dialog Box
    By Beaner in forum Windows Programming
    Replies: 3
    Last Post: 10-10-2008, 01:02 PM
  2. changing property (layout) of a printer
    By leojose in forum Windows Programming
    Replies: 5
    Last Post: 12-05-2005, 07:16 AM
  3. printer gone crazy
    By DavidP in forum Tech Board
    Replies: 2
    Last Post: 03-29-2004, 01:16 AM
  4. Success - Output to Printer
    By noraa in forum C Programming
    Replies: 5
    Last Post: 08-04-2002, 09:12 AM
  5. Replies: 0
    Last Post: 04-30-2002, 07:24 PM