Printing?

This is a discussion on Printing? within the C++ Programming forums, part of the General Programming Boards category; Sorry if this is a stupid question, but I was wondering. Is it possible to print something from a program. ...

  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    8

    Printing?

    Sorry if this is a stupid question, but I was wondering.
    Is it possible to print something from a program. For example, say I would like to display "Lala" on the screen and then print it out. Is it possible? If so, are there any resources to help me learn how to?

  2. #2
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343
    Is it possible to print something from a program
    Yes.

    Unfortunately there is no support for that in c++. You will have to use some other libraries/tool than thoose in standard c++. If you are programming in Windows there are surely some useful resources.
    01000111011011110110111101100100 011101000110100001101001011011100110011101110011 01100100011011110110111001110100 01100011011011110110110101100101 01100101011000010111100101110011 0110100101101110 01101100011010010110011001100101
    Good things donīt come easy in life!!!

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,652
    >> are there any resources to help me learn how to?
    The search feature of this site is fairly useful.

    gg

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Windows???

    I don't have all my references with me, but if you are running DOS (I mean true-DOS not a DOS-window) or Linux, it should be easy.

    This is C , but you can try it...
    Code:
    #include <cstdio>
    int x = 5;
    
    fprintf(stdprn, "The answer is  %d ", x);
    There are a couple of issues with Windows that I know of. I was never able to get my Windows console programs to print using standard C++. I think there is a way to do this, if your printer supports "DOS".

    You might have to use the Windows print functions, in the <windows> header, that work via the Windows driver supplied by the printer manufacturer. Some printers (like my Canon) won't print if you just send ASCII characters. The printer simply won't work without the using Windows drivers / functions.

  5. #5
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,794
    Quote Originally Posted by DougDbug
    There are a couple of issues with Windows that I know of. I was never able to get my Windows console programs to print using standard C++. I think there is a way to do this, if your printer supports "DOS".

    You might have to use the Windows print functions, in the <windows> header, that work via the Windows driver supplied by the printer manufacturer. Some printers (like my Canon) won't print if you just send ASCII characters. The printer simply won't work without the using Windows drivers / functions.
    Might be an issue with capturing a printer port, I don't think Windows does that as a default for any printers you set up. You have to go to your printer settings, right-click and look through all the options there. One of them should say something like "Capture Printer Port". You just need to make sure LPT1 is captured for your printer. Just a thought...
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# Printing Problem
    By silverlight001 in forum C# Programming
    Replies: 0
    Last Post: 03-23-2009, 01:13 AM
  2. generic printing preferences dialog box
    By stanlvw in forum Windows Programming
    Replies: 8
    Last Post: 06-27-2008, 02:20 AM
  3. printing data to a file
    By coralreef in forum C Programming
    Replies: 3
    Last Post: 11-02-2006, 07:10 PM
  4. need help relating printing?
    By omarlodhi in forum Linux Programming
    Replies: 0
    Last Post: 03-03-2006, 03:46 AM
  5. Printing
    By Dual-Catfish in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 05-25-2002, 08:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21