S
Shawn
Hello all..
I am quite new to C programming, but am having pretty good success so
far. I've written a short program to read from the serial port and
print the data to the screen, then quit. I'm starting simple!
My problem is that I only get the first line of data, up to the first
<cr>, then it quits. I'm sure this syntax isn't the best, so any
suggestions would be helpful. Here's how I'm doing it:
-------------------relavent code--------------
char sResult[4096];
fcntl(fd, F_SETFL, O_NDELAY);
read(fd, sResult, 200);
----------------------------------------------------
The messages that I read won't always be the same length, but should
always be less than 200. The output from the device looks like this:
P +
BNK +---------
CHN [ 1]
FRQ [ 856.3375]
CTC [ ]
With each line ending in a <cr>. When I compile and run all I get is:
P +
and nothing else. A dumb mistake, I'm sure. Any pointers/help
would be greatly appreciated. Thanks!
I am quite new to C programming, but am having pretty good success so
far. I've written a short program to read from the serial port and
print the data to the screen, then quit. I'm starting simple!
My problem is that I only get the first line of data, up to the first
<cr>, then it quits. I'm sure this syntax isn't the best, so any
suggestions would be helpful. Here's how I'm doing it:
-------------------relavent code--------------
char sResult[4096];
fcntl(fd, F_SETFL, O_NDELAY);
read(fd, sResult, 200);
----------------------------------------------------
The messages that I read won't always be the same length, but should
always be less than 200. The output from the device looks like this:
P +
BNK +---------
CHN [ 1]
FRQ [ 856.3375]
CTC [ ]
With each line ending in a <cr>. When I compile and run all I get is:
P +
and nothing else. A dumb mistake, I'm sure. Any pointers/help
would be greatly appreciated. Thanks!