Is there a convenient way to specify serial baud rate in GCC terminal programs?
by BruceV from LinuxQuestions.org on (#6P211)
Setting baud rate with gcc is done using enumerations, eg. B9600. This makes for awkward coding in terminal programs when the user specifies the required rate, what would be easier would be having the user simply enter the required value, eg. '9600'. Is there a way that this can be easily and efficiently implemented?
Doing it with the enumerations seems to unavoidably result in long strings of if/else, which I'd prefer to avoid.
Doing it with the enumerations seems to unavoidably result in long strings of if/else, which I'd prefer to avoid.