Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Printing with fopen, and f*()

Printing with fopen, and f*()

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminquestion
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    There is an article here at code project that says you can print directly to a printer by using fopen("lptN", "w") and writing to the file (just like normal). I really want to belive this because I have text and HP GL commands in a file that I need to send out to the printer. I try to fopen("lpt1", "w"); but I get a null pointer back. I did successfully map a printer to lpt1 (identical to his code except for the \\server\printer) (I don't remove it so I can heck via "net use") I am in windows 98. Does anyone have any ideas why it's not working?

    R S N C P 5 Replies Last reply
    0
    • A Anonymous

      There is an article here at code project that says you can print directly to a printer by using fopen("lptN", "w") and writing to the file (just like normal). I really want to belive this because I have text and HP GL commands in a file that I need to send out to the printer. I try to fopen("lpt1", "w"); but I get a null pointer back. I did successfully map a printer to lpt1 (identical to his code except for the \\server\printer) (I don't remove it so I can heck via "net use") I am in windows 98. Does anyone have any ideas why it's not working?

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      Try LPT:. I think (but am not sure) this is mapped to the default printer. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com

      S 1 Reply Last reply
      0
      • R Ravi Bhavnani

        Try LPT:. I think (but am not sure) this is mapped to the default printer. /ravi Let's put "civil" back in "civilization" http://www.ravib.com ravib@ravib.com

        S Offline
        S Offline
        Scorp1us
        wrote on last edited by
        #3

        Nope. PRN doesn't work either.

        1 Reply Last reply
        0
        • A Anonymous

          There is an article here at code project that says you can print directly to a printer by using fopen("lptN", "w") and writing to the file (just like normal). I really want to belive this because I have text and HP GL commands in a file that I need to send out to the printer. I try to fopen("lpt1", "w"); but I get a null pointer back. I did successfully map a printer to lpt1 (identical to his code except for the \\server\printer) (I don't remove it so I can heck via "net use") I am in windows 98. Does anyone have any ideas why it's not working?

          S Offline
          S Offline
          Scorp1us
          wrote on last edited by
          #4

          Here's another kicker.. opening \\server\printer works, but LPTx doesn't!

          1 Reply Last reply
          0
          • A Anonymous

            There is an article here at code project that says you can print directly to a printer by using fopen("lptN", "w") and writing to the file (just like normal). I really want to belive this because I have text and HP GL commands in a file that I need to send out to the printer. I try to fopen("lpt1", "w"); but I get a null pointer back. I did successfully map a printer to lpt1 (identical to his code except for the \\server\printer) (I don't remove it so I can heck via "net use") I am in windows 98. Does anyone have any ideas why it's not working?

            N Offline
            N Offline
            Nicolas Bonamy
            wrote on last edited by
            #5

            LPT stuff designs a printer connected to the parallel port. I doubt this will work with a USB printer or a network printer.

            1 Reply Last reply
            0
            • A Anonymous

              There is an article here at code project that says you can print directly to a printer by using fopen("lptN", "w") and writing to the file (just like normal). I really want to belive this because I have text and HP GL commands in a file that I need to send out to the printer. I try to fopen("lpt1", "w"); but I get a null pointer back. I did successfully map a printer to lpt1 (identical to his code except for the \\server\printer) (I don't remove it so I can heck via "net use") I am in windows 98. Does anyone have any ideas why it's not working?

              C Offline
              C Offline
              CvdWalt
              wrote on last edited by
              #6

              I believe the LptN explicityly refers to the physical LPT port. If you have redirected this port then you cannot write to it. This explains why you are able to write data to the UNC name not the physical port name.

              1 Reply Last reply
              0
              • A Anonymous

                There is an article here at code project that says you can print directly to a printer by using fopen("lptN", "w") and writing to the file (just like normal). I really want to belive this because I have text and HP GL commands in a file that I need to send out to the printer. I try to fopen("lpt1", "w"); but I get a null pointer back. I did successfully map a printer to lpt1 (identical to his code except for the \\server\printer) (I don't remove it so I can heck via "net use") I am in windows 98. Does anyone have any ideas why it's not working?

                P Offline
                P Offline
                PJ Arends
                wrote on last edited by
                #7

                fopen ("lpt1:", "w") Don't forget the colon.


                [

                ](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups