Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Outsmarting DOS C compiler to print to USB printer -- use DOS interrupt?

Reply
Thread Tools

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

 
 
tomhr
Guest
Posts: n/a
 
      01-10-2006
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.

 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      01-10-2006
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.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
 
Reply With Quote
 
 
 
 
Noway2
Guest
Posts: n/a
 
      01-10-2006
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.

 
Reply With Quote
 
mensanator@aol.com
Guest
Posts: n/a
 
      01-10-2006

tomhr wrote:
> 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.

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-10-2006
"(E-Mail Removed)" <(E-Mail Removed)> writes:
[...]
> 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.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
mensanator@aol.com
Guest
Posts: n/a
 
      01-10-2006

Keith Thompson wrote:
> "(E-Mail Removed)" <(E-Mail Removed)> writes:
> [...]
> > 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?

>
> --
> Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
> We must do something. This is something. Therefore, we must do this.


 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-10-2006
"(E-Mail Removed)" <(E-Mail Removed)> writes:
> 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.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Skarmander
Guest
Posts: n/a
 
      01-10-2006
(E-Mail Removed) wrote:
> 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.
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      01-10-2006
On 10 Jan 2006 13:48:40 -0800, in comp.lang.c , "(E-Mail Removed)"
<(E-Mail Removed)> wrote:

>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

>> --
>> Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>


>> We must do something. This is something. Therefore, we must do this.

Mark McIntyre
--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
mensanator@aol.com
Guest
Posts: n/a
 
      01-10-2006

Keith Thompson wrote:
> "(E-Mail Removed)" <(E-Mail Removed)> writes:
> > 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..."

>
> --
> Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
> We must do something. This is something. Therefore, we must do this.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing from DOS applications (lpt1) to USB attached printer in Vista MarkSatterfield General Computer Support 1 10-09-2008 01:59 AM
I need a CFRONT C++ Compiler for MS-DOS/Windows to replace an Apollo Domain 2.1.0 compiler Wormald C++ 1 02-06-2006 12:53 AM
how to Print via USB with non USB (Serial port) Printer Mighty Magpie Computer Information 6 01-31-2006 01:51 AM
Printing from DOS app under Win98 to USB printer - HOW? glenn Computer Support 3 11-19-2005 06:07 AM
OT: Printing from DOS to USB Printer Darth 2000 MCSE 4 02-15-2004 02:16 AM



Advertisments