In article <f6**********@tdi.cu.mi.it>, Army1987 <pl********@for.itwrote:
>
"helloguys" <zh******@gmail.comha scritto nel messaggio news:11**********************@e9g2000prf.googlegro ups.com...
>>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");
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.
--
Prototypes are supertypes of their clones. -- maplesoft