Home > Archive > Unix Programming > July 2006 > help required.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| chathsuom@gmail.com 2006-07-20, 7:00 pm |
| hi,
i am beginner for g++. i am using following code for reading from
serial port. but when i using it without a new line it doesnt read
anything. i need my prgram to read whenever other side is sending
without a new line.
fp = open("/dev/ttyS0", O_RDWR | O_NOCTTY |O_NDELAY);
fcntl(fp, F_SETFL,0);
read(fp,pPointer,2);
can any one help..
chaths
| |
| Pascal Bourguignon 2006-07-20, 7:00 pm |
| chathsuom@gmail.com writes:
> i am beginner for g++. i am using following code for reading from
> serial port. but when i using it without a new line it doesnt read
> anything. i need my prgram to read whenever other side is sending
> without a new line.
>
> fp = open("/dev/ttyS0", O_RDWR | O_NOCTTY |O_NDELAY);
> fcntl(fp, F_SETFL,0);
> read(fp,pPointer,2);
> can any one help..
By default, there's a cooked line discipline installed to the terminals.
You need to configure the device to behave as you want. To receive
each character as soon as it's available and with no processing,
you'll want to set it to the RAW mode, and to disable any special
character such as backspace, control-c, control-u, control-z, etc.
man termios
--
__Pascal Bourguignon__ http://www.informatimago.com/
NEW GRAND UNIFIED THEORY DISCLAIMER: The manufacturer may
technically be entitled to claim that this product is
ten-dimensional. However, the consumer is reminded that this
confers no legal rights above and beyond those applicable to
three-dimensional objects, since the seven new dimensions are
"rolled up" into such a small "area" that they cannot be
detected.
|
|
|
|
|