can i use bioscom to manipulate serial port on winxp

H

helloguys

i got a task to manipulate the jet printer. but i wanna only use C to
implement it and without MS's MFC and APIS,

i have wrote some codes in VS2003 with bioscom() but can not debug
it, and can not see anything from super terminal.

can anybody tell me, is it possible?
 
U

user923005

i got a task to manipulate the jet printer. but i wanna only use C to
implement it and without MS's MFC and APIS,

i have wrote some codes in VS2003 with bioscom() but can not debug
it, and can not see anything from super terminal.

can anybody tell me, is it possible?

You will have a bit of trouble printing without using any API, because
the library call to printf() is an API.
Now, you have not described manipulation of the printer. So we can
only guess what you mean by that.
Quite frankly, I'm a poor guesser.
But my guess is that you want:
or something of that sort.
 
A

Army1987

helloguys said:
i got a task to manipulate the jet printer. but i wanna only use C to
implement it and without MS's MFC and APIS,

i have wrote some codes in VS2003 with bioscom() but can not debug
it, and can not see anything from super terminal.

can anybody tell me, is it possible?

FILE *prn = fopen("whatever_your_system_calls_the_printer", "w");
 
W

Walter Roberson

FILE *prn = fopen("whatever_your_system_calls_the_printer", "w");

OP strongly implies MS Windows, in which case the serial port
might live off on USB somewhere and potentially needs special
handling to locate or create a device name (I haven't programmed
USB, but the dynamic nature of USB device connections pretty
much requires special handling.)

The OP mentioned "serial port". Serial ports almost always need
to be configured with signalling speed, and often need to
be configured with framing or asynch expectations (e.g.,
start bits, stop bits, bits per character, parity). The
mechanisms to make such configurations are outside of C.

So while there is a -possibility- that a plain fopen() of
some OS-specific name will get you Something Useful, the
chances are not good.


Also, I would suggest that "wb" might be more appropriate than "w"
for manipulating a printer: a number of them allow blocks of
data to be encoded in binary, and you don't want random newline
transformations happening in the middle of that.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top