Click to See Complete Forum and Search --> : Write to parallel port using CSharp?


Jim_Auricman
April 2nd, 2009, 12:26 PM
Writing to a parallel (printer) port in the old days of 'C' was easy.
outp(lpt1, lpt1_port_val);
Does CSharp provide capability to write to and read from a parallel port?
Or have the latest Windows OS like XP and Vista precluded one from using a parallel port? (if one could find a computer that had anything other than the USB port)

Shuja Ali
April 2nd, 2009, 02:10 PM
Yes you can do it in C# too. Read I/O Ports Uncensored - 1 - Controlling LEDs (Light Emiting Diodes) with Parallel Port (http://www.codeproject.com/KB/cs/csppleds.aspx)

nabeelisnabeel
April 3rd, 2009, 05:48 AM
[DllImport("inpout32.dll", EntryPoint="Out32")]
public static extern void Output(int adress, int value);

is the way to do it using C#.

Jim_Auricman
April 3rd, 2009, 04:06 PM
Thanks for the responses. The last 3 PCs I bought have only USB ports.
I regret this, since parallel port interface is simpler to implement than to USB ports, but it is good to know that C-Sharp does provide a means to talk to a parallel port if it were available.