How can I communicate with the parallel port in C#?

  • Thread starter Thread starter Guest
  • Start date Start date
..NET 1.X does not support serial communications. You need to call unmanaged
api (e.g. CreateFile("LPT1",GENERIC_READ | GENERIC_WRITE,0, 0,OPEN_EXISTING,0,
0); ...)
Aleksey Nudelman,
http://csharpcomputing.com
 
.... And once you have the Handle, you can pass into one of the constructors
of the FileStream object and then do the usual stream I/O:

FileStream lpt = new
FileStream(hFS,System.IO.FileMode.Append,FileAccess.Write);
String Temp="test";
Byte[] Buff = new Byte[1024];
Buff = System.Text.Encoding.Unicode.GetBytes(Temp);
lpt.Write(Buff,0,Buff.Length);
lpt.Close();

Sujit D'Mello
 

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

Back
Top