6 Replies Latest reply on Feb 19, 2015 4:32 PM by ben.satkiewicz

    Best Way to Read UART String


      I am trying to figure out the best way to read a string character by character with the UART. Since it does not have a read string method, I want to write my own.


      The method has to return a C string terminated by a null character (the C standard) not delivered by the UART. The number of characters needs to be indefinite. The easiest way to pull this off is to declare a buffer (char array) of a fixed size but this is wasteful. Plus the number of chars may exceed the fixed size.


      My knowledge of pointers and dynamic memory allocation in C is not very sound.