Capture Printer Port in XP Home

I have a Kodak printer that is connected through my Wireless Router. I can print to it from Windows. I do some C programing so far in Character-mode. I'm trying to send a report to the printer. In Win9x I could capture a port ( Lpt1, etc ) and print from the character mode (DOS to us old-timers). I am unable to do that in XP.
So far, the only way is to print to a file then have Notepad print it ( system( Notepad /p MyReport.txt ). This does require me to guess at Notepad's page size so I can reprint the page header. Also, Notepad uses a variable size text so my columns ( which lined up on the screen,) don't on paper. And Notepad puts the filename at the top of the page and the page number at the bottom which I could yurn off BEFORE I run my program then remember (gasp!) to turn it back on.
I'ds much rather send my report diretly to the printer and insert the page breaks where I want them. Is this possible?

Discussion is locked
Reply to: Capture Printer Port in XP Home
PLEASE NOTE: Do not post advertisements, offensive materials, profanity, or personal attacks. Please remember to be considerate of other members. If you are new to the CNET Forums, please read our CNET Forums FAQ. All submitted content is subject to our Terms of Use.
Reporting: Capture Printer Port in XP Home
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
- Collapse -
Short answer: No

Short answer: No

Since you're a programmer, I'll assume you can figure out the details on your own. XP is a protected mode OS, whereas 9x was sort of a real-mode/protected-mode hybrid. It encouraged protected mode programming, but didn't really enforce it.

- Collapse -

You call me a programmer but I've been trying to learn C for over 20 years. I was dragged into Win3.1 kicking and screaming. Also with Win95 & 98. I learned real quick to stay away fron NT. Unfortunately, my older machines are beyond repair and this XP laptop (netbook?) had been purchased to access Yahoo and other sites with their bloated screens. I was happy to discover that I could continue my project but, alas it will be crippled until I can afford a Linux computer.

In spite of my rant, thank you for your answer.

- Collapse -
Then let me save you some time

Then let me save you some time and tell you that Linux is also a protected mode OS, so you'll have pretty much the same problems there. You will be hard pressed to find a real-mode OS anymore, besides maybe FreeDOS which is intended as kind of a niche product. Protected mode operating systems provide all kinds of useful benefits like preventing one app from clobbering the memory address of another app causing the infamous GPF errors in Win 3.x, they also limit the ability of viruses considerably. It doesn't eliminate the possibility, but it increases the complexity of the code needed to write an effective virus, which is probably why there's been a near total dropoff in the number of new viruses since the shift to XP. Everyone has moved to the new low hanging fruit that is Internet Explorer's ActiveX system.

In any case, unless you load a copy of FreeDOS onto a computer, you're just not going to find a real mode OS anymore. They're too much of a liability. So your project is going to need to be restructured in a pretty fundamental way it seems.

- Collapse -
How I solved this problem.

NOT ABOUT CAPTURING THE PRINTER OUTPUT but how I solved the formatting issue.

Remember that I write apps for money so I had to solve this too. What I found useful was to send the text to a file as well but I wrapped it all up with HTML code. This way it could be rendered and printed on Linux, MacOS X, Windows and more without me rewriting my source code.

I figured this out long ago (pre-2000) and it's been on the production lines for over a decade.


- Collapse -

Thanks for your reply, Jimmy. I have used Linux a little bit and knew that it shared that down-side with Windows. On the other hand, it does let me get my hand under the hood to do things that I have yet, in spite of more experiance with Windows, been unable to do.

Thanks for tip, Bob. My C primer Mix "Power C" has a chapter on html but I never found a use for it. Now, I'll go back and study it and see if I can get that to work. Come to think about it, I could use more than one font and Bold text as well. That was what I needed - a nudge in a different direction. Thank you again.


- Collapse -

Opps! I took the wrong book last week: it should have been 'C Windows Toolchest'. It does have a chapter on Html 2 but didn't give the information to format to columns, ie: fields of a database. I managed to search this morning and found Beguinner information which discusses Html 4 and 5. So far, it has gotten me as far as the book has. Hopefully, I can spend some time on the internet and look at the Advanced chapter.


CNET Forums