clear serial port??
Sometimes when I transmmit the data from one com port to the other. And there are always "something" left in the com port even after I closed the program. I've to restart the computer then. It is kinda of strange, So is there function or way to clear the serial port after the program closed?
I would appreciate for any help
Check out the code I attached in this thread, SFile.zip.
Use the object if you like, otherwise, just take a look at the PurgeComm() method.
When I was runing the program, I got such error:
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/SFile.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...
SFile.exe - 2 error(s), 0 warning(s)
What shall I do? Thanks
SFile.zip only contains the SFile class. There is no main() or WinMain() that actually uses it.
Thanks, but BTW: in
HANDLE hFile, // handle to file
LPVOID lpBuffer, // data buffer
DWORD nNumberOfBytesToRead, // number of bytes to read
LPDWORD lpNumberOfBytesRead, // number of bytes read
LPOVERLAPPED lpOverlapped // overlapped buffer
is it always nNumberOfBytesToRead = lpNumberOfBytesRead??
for example if I set ReadFile() to read 10 bytes at a time from input buffer of COM1, so lpNumberOfBytesRead is 10 bytes too?
Am I right??
*lpNumberOfBytesRead is an output parameter and gets set to 0 first thing by ReadFile().
When ReadFile() returns, *lpNumberOfBytesRead will be 10 only if it read 10 bytes.
Hey I was jsut wondering where you got this class from? Or did you write it yourself?