Thread: Clearing Serial Port

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    9

    Clearing Serial Port

    How do you clear the serial port buffer. The data that my program is reading in seems to be getting cut off.

  2. #2
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    http://www.beyondlogic.org/serial/serial.htm

    That should solve your queries(i hope).
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    9

    I have read that but...

    I have read this document but I don't really know whats going on. Isn't there just some function I can send to empty the buffer?

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Depends... which buffer? If you mean input buffer then no there isn't. Depending on exactly how it is setup you might be able to use fflush() to flush the output buffer.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    14

    Win based?

    I take it your not using Win2K/XP; I have had serious problems working with this in the past. I ended up resorting to VB. Access to quite a lot of the low level stuff was disabled in order to comply with some security rating for US mil. These problems don't seem to exist in the previous versions (I've not tried NT4) and definitely don't in Linux (although producing a product which only runs on Linux may be a little pointless.
    Currently Reading:

    Mathematic from the birth of numbers,
    Effective TCP/IP programming,
    Data Compression: The Complete Reference,
    C Interfaces and Implementations: Techniques for Creating Reusable Software,
    An Introduction to Genetic Algorithms for Scientists and Engineers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. serial port to poll on request
    By infineonintern in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 06:52 AM
  2. clearing windows serial port allocations
    By cnewb999 in forum C Programming
    Replies: 0
    Last Post: 06-29-2008, 02:47 AM
  3. Can't Read From Serial Port
    By HalNineThousand in forum Linux Programming
    Replies: 14
    Last Post: 03-20-2008, 05:56 PM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  5. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM