Thread: EOF reading in the buffer

  1. #1
    Registered User
    Join Date
    Sep 2001

    EOF reading in the buffer


    If I want the program to know whether it is the end of data in the input buffer in the serial port. So I do:

    DCB dcb={0};
    if(!GetCommState(hCom1, &dcb))  //get default dcb settings
      printf ("GetCommState is failed\n");
    dcb.EofChar = '3'; //want character '3' to indicate the end of     
                                  //the data in the input buffer
    if(!SetCommState(hCom1,&dcb)) //re-set the dcb
        printf("SetCommState is failed\n");
    but it didn't work, even if the string in the input buffer is, for example {'1','2','3','4'},

    but it still read the whole string, I think character '4' should be read at least. What's going on with this?? Thank you.
    Don't laugh at me,I am just a SuperNewbie.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Don't count on that working.
    Either you know how many bytes to expect or you devise a protocal so that you know when to stop reading.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with altering info on a txt file
    By Netflyer in forum C Programming
    Replies: 29
    Last Post: 02-14-2008, 07:23 AM
  2. Replies: 2
    Last Post: 01-28-2008, 03:07 AM
  3. clear buffer
    By justins in forum C Programming
    Replies: 5
    Last Post: 05-19-2007, 06:16 AM
  4. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  5. DirectSound - multiple sounds
    By Magos in forum Game Programming
    Replies: 9
    Last Post: 03-03-2004, 04:33 PM