i am using VC6
Also how do i send text to my printer without using APIs
I have tried
FILE *fp=fopen("lpt1", "w");
and
FILE *fp=fopen("lpt1:", "w");
it gave me a runtime error
i am using VC6
Also how do i send text to my printer without using APIs
I have tried
FILE *fp=fopen("lpt1", "w");
and
FILE *fp=fopen("lpt1:", "w");
it gave me a runtime error
I think you can do
fprintf("LPT1","Hello, world!");
Not sure though
Oskilian
I've used this in C++:
expect problems with bubblejet and some laser printers.Code:const char EJECT = 0x0c; // printer page eject command ofstream print; print.open( "LPT1" ); and this in C: FILE *prnPtr; prnPtr = fopen("lpt1", "w");
it is not working. it is returning NULL
I am using VC++
> it is returning NULL
Yeah, so the next step is find out why
Do this then post the error message, if it isn't already obvious what is going wrong.Code:FILE *fp=fopen("lpt1", "w"); if ( fp == NULL ) { perror( "No printer" ); exit( 1 ); }
there is a printer connected to my computer.
have you tried it on there system.
have you tried "PRN" instead of "LPT1" ?
All spelling mistakes, syntatical errors and stupid comments are intentional.
Let's hope it is actually connected to lpt1 and not a USB port.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
ya man, it is connected to a usb
my printer is connected to the usb port.
do you how to open a printer connected to the usb port
Also how do i send text to my printer without using APIs
my printer is connected to a usb port
I think you're going to find that very difficult. Very difficult indeed. One thing you can try (I don't know how likely it is this will work for you, but it is possible, at least on some versions of Windows)...
[list=a][*]Install file & printer sharing[*]Share your USB printer[*]DROP to a DOS prompt and type "net use lpt1: \\<computer_name>\<printer_name>"[*]Then use the output to LPT1, as posted in your other thread[/list=a]
Computer name is the network name of your PC
Printer name is what ever name you give when sharing your printer.
You may find you need to push form feed characters to your printer in order to get it to spit out any text you have sent it, if you haven't sent it a full page.
You may also be able to look in your printer manual for other escape sequences to change fonts or other settings.
Good luck.
Demonographic rhinology is not the only possible outcome, but why take the chance
or you could do like salem says and post the error message.
What make of printer?
All spelling mistakes, syntatical errors and stupid comments are intentional.
Lexmark Z12
err.... it's connected to a USB port, hence it's not known to the system via ltp1. The error message is pretty irrelevant at this pointOriginally posted by C_Coder
or you could do like salem says and post the error message.
What make of printer?
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]