开发者

is it possible to use serialport class in c?

开发者 https://www.devze.com 2023-02-06 07:47 出处:网络
im trying to read newline terminated strings using windows api and saw that the serialport class has a serialport.newline member开发者_运维问答. i want to know if it is possible to use the serialport

im trying to read newline terminated strings using windows api and saw that the serialport class has a serialport.newline member开发者_运维问答. i want to know if it is possible to use the serialport class in c and how


In (Microsoft) C, you'd need to call CreateFile to get a handle to the serial port, and _open_osfhandle(handle, _O_TEXT) to convert it to a file descriptor. You can get a FILE* from that file descriptor with _fdopen. After that, fscanf will read lines.


Serialport is a .Net class. You cannot use it in C. You will need to create a VC++.Net project(also refered to as C++/CLI) project.

0

精彩评论

暂无评论...
验证码 换一张
取 消