Computer Help forum


Capture Printer Port in XP Home

by straybit / June 10, 2011 10:36 AM PDT

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
You are posting a reply to: Capture Printer Port in XP Home
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: 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.

All Answers

Collapse -
Short answer: No
by Jimmy Greystone / June 10, 2011 10:40 AM PDT

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 -
by straybit / June 10, 2011 1:51 PM PDT
In reply to: Short answer: No

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
by Jimmy Greystone / June 10, 2011 10:52 PM PDT
In reply to: Nuts!!

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.
by R. Proffitt Forum moderator / June 11, 2011 2:56 AM PDT

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 -
by straybit / June 11, 2011 9:06 AM PDT

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 -
by straybit / June 19, 2011 11:46 AM PDT
In reply to: Thanks

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.


Popular Forums
Computer Newbies 10,686 discussions
Computer Help 54,365 discussions
Laptops 21,181 discussions
Networking & Wireless 16,313 discussions
Phones 17,137 discussions
Security 31,287 discussions
TVs & Home Theaters 22,101 discussions
Windows 7 8,164 discussions
Windows 10 2,657 discussions

Does BMW or Volvo do it best?

Pint-size luxury and funky style

Shopping for a new car this weekend? See how the BMW X2 stacks up against the Volvo XC40 in our side-by-side comparison.