is it possible to use serialport class in c?
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.
精彩评论