Outsmarting DOS C compiler to print to USB printer -- use DOS interrupt?

T

tomhr

I have a Borland Turbo C++ compiler (though I never use the "plus-plus"
part), copyright 1990. I use this compiler to write simple programs,
one of which I am quite dependent on.

A month ago, my parallel-port-output printer died, and I got a Samsung
printer that takes info from the USB port. Every time I go into DOS
mode and try to send something to that printer, whether from a command
line ("dir>prn"), or from one of my programs, I get an error message.

It occured to me that if I called an interrupt from my DOS program,
that's how I could send characters to my USB printer. Is this possible,
and what interrupt do I use? To give an example, Interrupt 17h,
Function 00h is the (no longer useful) interrupt that sends a character
to the parallel port.
 
R

Richard Heathfield

tomhr said:
It occured to me that if I called an interrupt from my DOS program,
that's how I could send characters to my USB printer. Is this possible,
and what interrupt do I use? To give an example, Interrupt 17h,
Function 00h is the (no longer useful) interrupt that sends a character
to the parallel port.

It may well be possible, but your best bet of finding out would be over in
comp.os.msdos.programmer - where they specialise in this kind of thing.
 
N

Noway2

It should (actually I am very certain that it is) possible to get USB
to function under dos, but based on my experience with USB (and dos) I
highly doubt that it will be as simple as calling an interrupt. The
problem is that you need a USB driver for dos and on top of that the
driver needs to know how to handle the type of device that you are
trying to communicate with.

If you are feeling adventurous, it may be possible to access the USB
host controller that is in the PC and you could then write a driver for
it. I also believe that someone (I forget who) did write a USB driver
for DOS, which may serve your needs. I stumbled across references to
this USB driver but I never downloaded it.
 
M

mensanator

tomhr said:
I have a Borland Turbo C++ compiler (though I never use the "plus-plus"
part), copyright 1990. I use this compiler to write simple programs,
one of which I am quite dependent on.

A month ago, my parallel-port-output printer died, and I got a Samsung
printer that takes info from the USB port. Every time I go into DOS
mode and try to send something to that printer, whether from a command
line ("dir>prn"), or from one of my programs, I get an error message.

It occured to me that if I called an interrupt from my DOS program,
that's how I could send characters to my USB printer. Is this possible,
and what interrupt do I use? To give an example, Interrupt 17h,
Function 00h is the (no longer useful) interrupt that sends a character
to the parallel port.

I assume from "dos mode" and "usb" that you're running Windows.
I also assume that you have a Windows driver for the usb printer.

Try this.

Create a sharename for the printer.

[control panel/printers/right click/properties/sharing]

Start a dos command window.

C:/>net use \\mypc\printersharename LPT1:

(You can share your own resources with yourself.)

That will set the dos lpt1: printer hook to the windows usb driver.
 
K

Keith Thompson

I assume from "dos mode" and "usb" that you're running Windows.
I also assume that you have a Windows driver for the usb printer.

Try this.

Create a sharename for the printer.

[control panel/printers/right click/properties/sharing]

Start a dos command window.

C:/>net use \\mypc\printersharename LPT1:

(You can share your own resources with yourself.)

That will set the dos lpt1: printer hook to the windows usb driver.

The majority of us here have no idea whether that's correct. It could
be exactly the right solution, or it could have some subtle flaw
that's going to bite the user in an anatomically inconvenient location
at the worst possible moment.

That's why we encourage people to take system-specific discussions to
system-specific newsgroups. There are plenty of newsgroups that
discuss Windows and/or DOS programming. This isn't one of them.
 
M

mensanator

Keith said:
I assume from "dos mode" and "usb" that you're running Windows.
I also assume that you have a Windows driver for the usb printer.

Try this.

Create a sharename for the printer.

[control panel/printers/right click/properties/sharing]

Start a dos command window.

C:/>net use \\mypc\printersharename LPT1:

(You can share your own resources with yourself.)

That will set the dos lpt1: printer hook to the windows usb driver.

The majority of us here have no idea whether that's correct.

And I have no way of testing it.
It could be exactly the right solution,

It has been known to work in similar cases.
or it could have some subtle flaw
that's going to bite the user in an anatomically inconvenient location
at the worst possible moment.

More likely it simply won't work at all, or it will work when he
does dir>prn but fail when his application tries to print because
the application bypasses the OS hook.
That's why we encourage people to take system-specific discussions to
system-specific newsgroups. There are plenty of newsgroups that
discuss Windows and/or DOS programming. This isn't one of them.

And the person to scold is the OP. What kind of spiteful person
withholds an answer from some poor slob simply because his
post was off-topic? Would you ask a drowning person to fill out
a form before throwing him a life preserver?
 
K

Keith Thompson

Keith Thompson wrote: [snip]
That's why we encourage people to take system-specific discussions to
system-specific newsgroups. There are plenty of newsgroups that
discuss Windows and/or DOS programming. This isn't one of them.

And the person to scold is the OP. What kind of spiteful person
withholds an answer from some poor slob simply because his
post was off-topic? Would you ask a drowning person to fill out
a form before throwing him a life preserver?

The OP may or may not deserve to be scolded. The person who posted a
detailed off-topic answer certainly does.

Drowning people don't post to Usenet; this wasn't a life-and-death
emergency. The OP asked for help. The best way to provide that help
is to redirect him to a newsgroup where the regulars actually know
something about the topic. If you happen to have the expertise and
want to help personally, you can post in the appropriate newsgroup
yourself.

If you think we should answer any and all questions here, maybe we
should change the name of the newsgroup to comp.whatever, or perhaps
whatever.whatever.
 
S

Skarmander

What kind of spiteful person withholds an answer from some poor slob
simply because his post was off-topic? Would you ask a drowning person to
fill out a form before throwing him a life preserver?

Depends. Did he cross-post?

S.
 
M

Mark McIntyre

And the person to scold is the OP.

And the idiot who replies to his posts, thus encouraging the OP to
think he's in the right place. .
What kind of spiteful person
withholds an answer from some poor slob simply because his
post was off-topic?

Who said to withold an answer? The answer is however not to tell him
something free from peer review, but to direct him to where he will
learn more and more correctly.
Would you ask a drowning person to fill out
a form before throwing him a life preserver?

Since when has anyone drowned trying to write USB drivers?c

oh, and you need a bett4er newsreader, yours doesn't snip sigs :-(
Mark McIntyre
 
M

mensanator

Keith said:
Keith Thompson wrote: [snip]
That's why we encourage people to take system-specific discussions to
system-specific newsgroups. There are plenty of newsgroups that
discuss Windows and/or DOS programming. This isn't one of them.

And the person to scold is the OP. What kind of spiteful person
withholds an answer from some poor slob simply because his
post was off-topic? Would you ask a drowning person to fill out
a form before throwing him a life preserver?

The OP may or may not deserve to be scolded. The person who posted a
detailed off-topic answer certainly does.

Sorry, but when I see three balls, I must juggle them. When I see
two towers, I must walk between them. When I see a cry for help,
I must reply to it.
Drowning people don't post to Usenet; this wasn't a life-and-death
emergency.

No one is criticising you for not knowing the answer.
The OP asked for help.

And if I know the answer, I'm going to reply, damn the rules.
The best way to provide that help
is to redirect him to a newsgroup where the regulars actually know
something about the topic.

That would be the best way. And the best way to relieve famine
in Sudan is to end the war. But that doesn't mean we shouldn't
try to help those starving in the refugee camps.
If you happen to have the expertise and
want to help personally, you can post in the appropriate newsgroup
yourself.

If _I_ have to expend a lot of effort, it won't happen.
If you think we should answer any and all questions here, maybe we
should change the name of the newsgroup to comp.whatever, or perhaps
whatever.whatever.

Look, once the message has been posted here, it's water
under the bridge. I have no problems with Richard Heathfield's
reply where he suggested the OP take his question elsewhere.
I did not feel any obligation to suggest that since it had already
been done. And if I was going to play newscop, I would still say
"This is off-topic here, but try this..."
 
M

mensanator

Mark said:
And the idiot who replies to his posts, thus encouraging the OP to
think he's in the right place. .


Who said to withold an answer? The answer is however not to tell him
something free from peer review, but to direct him to where he will
learn more and more correctly.


Since when has anyone drowned trying to write USB drivers?c

oh, and you need a bett4er newsreader, yours doesn't snip sigs :-(

And yours doesn't spellcheck.
Mark McIntyre
 
T

tomhr

Guys, if I'd _wanted_ to be (knowingly) off-topic, I would have written
"George W. Bush is a slug" or "I love satellite radio."

Is getting this program to print to a USB printer "life or death"? No.
But the alternative to tweaking the DOS-platform program I have now is
to buy a Windows C compiler, learning all about how it worked, then
rewriting and debugging my old DOS-C program to work under Windows.
This would take weeks, possibly months. Posting here seemed to (newbie)
me to be the better alternative.

Hey, I can appreciate someone posting, "I don't have an answer for you,
but this other newsgroup might." But to declare that I deserve scolding
because I didn't know this was the "wrong" group? Sheesh. May you never
wind up in an emergency room without your insurance card.

I'm gone. Noway2 and mensanator, thanks for your help.
 
C

Chuck F.

Keith said:
Keith Thompson wrote:
That's why we encourage people to take system-specific
discussions to system-specific newsgroups. There are
plenty of newsgroups that discuss Windows and/or DOS
programming. This isn't one of them.

And the person to scold is the OP. What kind of spiteful
person withholds an answer from some poor slob simply
because his post was off-topic? Would you ask a drowning
person to fill out a form before throwing him a life
preserver?

The OP may or may not deserve to be scolded. The person who
posted a detailed off-topic answer certainly does.
.... snip ...

And if I know the answer, I'm going to reply, damn the rules.

So you deserve scolding, for ignoring topicality (of which you are
obviously aware). You can always post an answer of the form:

"Go to group xxx. I am adding that to the distribution and setting
followups to that."

after which you can go to group xxx yourself (assuming things are
topical there) and answer away to your hearts content.

There is no need for you to foul this newsgroup with this off-topic
nonsense.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
K

Kenny McCormack

And the person to scold is the OP. What kind of spiteful person
withholds an answer from some poor slob simply because his
post was off-topic? Would you ask a drowning person to fill out
a form before throwing him a life preserver?

In this newsgroup, yes, they would.

Actually, they would explain, in a artfully crafted, 172 line post, why
life preservers are O/T. While the person drowns, of course...
 
M

mensanator

Chuck said:
Keith said:
Keith Thompson wrote:

That's why we encourage people to take system-specific
discussions to system-specific newsgroups. There are
plenty of newsgroups that discuss Windows and/or DOS
programming. This isn't one of them.

And the person to scold is the OP. What kind of spiteful
person withholds an answer from some poor slob simply
because his post was off-topic? Would you ask a drowning
person to fill out a form before throwing him a life
preserver?

The OP may or may not deserve to be scolded. The person who
posted a detailed off-topic answer certainly does.
... snip ...

And if I know the answer, I'm going to reply, damn the rules.

So you deserve scolding, for ignoring topicality (of which you are
obviously aware). You can always post an answer of the form:

"Go to group xxx. I am adding that to the distribution and setting
followups to that."

after which you can go to group xxx yourself (assuming things are
topical there) and answer away to your hearts content.

There is no need for you to foul this newsgroup with this off-topic
nonsense.

Why do you continue to foul this newsgroup with that off-topic
rant about the Google reply link? It's been pointed out to you
that the information is wrong and incomplete. Why do you
continue to use it?

The OP is at least able to learn. Why can't you?
 
C

Chuck F.

tomhr said:
.... snip ...

Hey, I can appreciate someone posting, "I don't have an answer
for you, but this other newsgroup might." But to declare that I
deserve scolding because I didn't know this was the "wrong"
group? Sheesh. May you never wind up in an emergency room
without your insurance card.

I don't believe anybody scolded _you_ for OT posting. Newbies
generally don't know the first time. But the many others who
replied with OT data rather than referring you do deserve scolding,
because they (presumably) should know better.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
K

Keith Thompson

tomhr said:
Guys, if I'd _wanted_ to be (knowingly) off-topic, I would have written
"George W. Bush is a slug" or "I love satellite radio."

Is getting this program to print to a USB printer "life or death"? No.
But the alternative to tweaking the DOS-platform program I have now is
to buy a Windows C compiler, learning all about how it worked, then
rewriting and debugging my old DOS-C program to work under Windows.
This would take weeks, possibly months. Posting here seemed to (newbie)
me to be the better alternative.

Hey, I can appreciate someone posting, "I don't have an answer for you,
but this other newsgroup might." But to declare that I deserve scolding
because I didn't know this was the "wrong" group? Sheesh. May you never
wind up in an emergency room without your insurance card.

I'm gone. Noway2 and mensanator, thanks for your help.

I don't recall anyone scolding you. I certainly didn't. My scolding
was directed at the person who posted an inappropriate followup rather
than telling you where to find reliable information.
 
K

Keith Thompson

Chuck F. wrote: [...]
There is no need for you to foul this newsgroup with this off-topic
nonsense.

Why do you continue to foul this newsgroup with that off-topic
rant about the Google reply link? It's been pointed out to you
that the information is wrong and incomplete. Why do you
continue to use it?

The OP is at least able to learn. Why can't you?
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>

I've been following both this newsgroup and the groups.google.com
problems very closely. I don't recall seeing anyone mention that the
standard Google advice or Chris F.A. Johnson's web page is incorrect.
(I remember someone recently saying that it didn't work for him, he
didn't give any details.)

If there are any errors in <http://cfaj.freeshell.org/google/> I'm
sure Chris F.A. Johnson would be interested in knowing about it. So
would I. If you have some concrete information on this, feel free to
send an e-mail message directly to me or to post to this newsgroup
(not both, please).

I know that groups.google.com has been having some problems in the
last few days; if those problems make the standard advice invalid, I'm
not aware of it.
 
K

Keith Thompson

Keith Thompson said:
Chuck F. wrote: [...]
There is no need for you to foul this newsgroup with this off-topic
nonsense.

Why do you continue to foul this newsgroup with that off-topic
rant about the Google reply link? It's been pointed out to you
that the information is wrong and incomplete. Why do you
continue to use it?

The OP is at least able to learn. Why can't you?
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>

I've been following both this newsgroup and the groups.google.com
problems very closely. I don't recall seeing anyone mention that the
standard Google advice or Chris F.A. Johnson's web page is incorrect.
(I remember someone recently saying that it didn't work for him, he
didn't give any details.)

If there are any errors in <http://cfaj.freeshell.org/google/> I'm
sure Chris F.A. Johnson would be interested in knowing about it. So
would I. If you have some concrete information on this, feel free to
send an e-mail message directly to me or to post to this newsgroup
(not both, please).

Ok, I got an e-mail response from mensanator. As far as I can tell,
his complaint is that there's *another* workaround that Chris's web
page doesn't mention.

But it appears that the whole thing is now moot. I'll start a new
thread with the details (look for an article with "Google" in the
subject header).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top