470,594 Members | 1,131 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

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

C#
How can I communicate with the parallel port in C#?
Nov 22 '05 #1
2 13271

..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

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

Nov 22 '05 #2
.... 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,FileAcces s.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

"csharpcomputing.com" wrote:

.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

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

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Novice Experl | last post: by
1 post views Thread by c_attitude | last post: by
1 post views Thread by Eric | last post: by
12 posts views Thread by david.brown.0 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.