Thread: How to print out the data throw printer.Attn Salem

  1. #1
    Registered User
    Join Date
    Aug 2001

    Exclamation How to print out the data throw printer.Attn Salem

    How to print out the data using printer?
    My problem is how can printer print out the data of my need.In my program i ready can display the data of i need in screen ,but now i want print the data out but, i don't know what should do.
    If who know please give me the sample code, for reference
    Salem i using window 98 and borland turbo c++ 4.5 compiler.
    and if i want select record from the data file ,and i only want print this select data it is also can use the code of u given?
    Last edited by Jason; 09-25-2001 at 05:54 AM.

  2. #2
    Registered User
    Join Date
    Sep 2001
    I also would like to know. Im using Borland C++ Builder 3 on Windows NT4 Workstation (Service Pack 6). Hope this is enough

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    #include <stdio.h>
    int main ( int argc, char **argv ) {
    // use one of these to open a stream to the printer
    //    FILE *fp = stdprn;    // some environments define this at startup
    //    FILE *fp = fopen( "LPT1:", "w" );
    //    FILE *fp = fopen( "PRN:", "w" );
        // print to the printer
        // the \f is a formfeed - you might not see anything until you
        // use this to tell the printer the page is complete
        fprintf( fp, "hello world\n\f" );
        return 0;
    Try one of these FILE* pointers
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. question about a working linked list
    By cold_dog in forum C++ Programming
    Replies: 23
    Last Post: 09-13-2006, 01:00 AM
  3. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  4. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  5. C diamonds and perls :)
    By Carlos in forum A Brief History of
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM