Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi All :)
I'm writing an application in C++/CLI and I have a problem with serial transmission. At the beggining, I got some additional data, which are not supposed to be there. I'm using SerialPort class. Probably buffer should be cleared before the transimission starts. Does DiscardOutBuffer() work similar to fflush() in C? Can you please give me any advice?
Posted
Updated 24-Nov-11 3:44am
v2
Comments
Sergey Alexandrovich Kryukov 23-Nov-11 22:16pm    
Remove "managed C++" from the title, say "C++/CLI". This is the language superseded by C++/CLI, which is a very different thing.
--SA
Bubbles85 24-Nov-11 9:45am    
Thanks, you are right, I've changed the title.

Judging by this[^], I would say not.
 
Share this answer
 
Hi,

This link will help you

<a href="http://www.tech-forums.net/pc/f11/flush-serial-port-read-buffer-c-226473/">http://www.tech-forums.net/pc/f11/flush-serial-port-read-buffer-c-226473/</a>[<a href="http://www.tech-forums.net/pc/f11/flush-serial-port-read-buffer-c-226473/" target="_blank" title="New Window">^</a>]
 
Share this answer
 
v5
Try using the PurgeComm API.

For your reference:
http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/c2503[^]

Best regards!
 
Share this answer
 
Comments
Bubbles85 4-Dec-11 10:45am    
I still did not solve this problem. All of your propositions require some external libraries or are dedicated for different class that the one that I'm using :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900