hi,
i want to write data on printer port ,have any cammand that do that.
the data may be 0 or 1
Thanx
Printable View
hi,
i want to write data on printer port ,have any cammand that do that.
the data may be 0 or 1
Thanx
Use CreateFile to open your LPT device as described under communication resources. Instead of "COM1" just open "LPT1". If you have any further questions, feel free to ask again. ;)
Does CreateFile work with NT,2000,XP?
yep it doesQuote:
Originally Posted by eeboy
regards
sreehari
To know what operating systems are supported by an api, look under the Requirements section of that api in MSDN.Quote:
Originally Posted by eeboy
CreateFile
Actually i want to write bit on printer port pin.i has been done it in delphi,if we write 1 on a pin then it show high voltage and 0 for low,i just need a simple code that how i can write
data in a printer port on any PIN,
In simple C we use
outportb(port NO,value); can it work for my this problem in vc++.
I m using XP and Tool VC++ 6.0
Your question is not clear :confused: you have been told above how to do it, you can also look at this article: Using standard printing from windowsQuote:
Originally Posted by kku
please be more specific.
Cheers
I know CreateFile will work under NT,2000,XP but if you try to obtain a handle and access the port don't you generate an exception? It's been a while but as I recall you get a priviliged instruction exception. Not true?
Quote:
Originally Posted by eeboy
First ::CreateFile(..) will work in win95 and higher you can refer to msdn for more info, look at leojose post.
Now to your question about exception, why do you think you will get exception if you try open that port via ::CreateFile(..) ? :confused:
Did you try it and get exception? You should check the handle you get and if its INVALID_HANDLE_VALUE you can use ::GetLastError() for more info about the failure.
Cheers