tecknophreak
07-31-2001, 04:16 PM
I've got a bit of a problem. I've read over the serial programming howto and typed up the Asynchronous Input Example.
Basically it's supposed to get five chars and output them until just a <CR> is recieved. Well for some reason, it puts everything in the buffer and doesn't output the buffer until a CR is passed.
here's the while loop, in case i'm missing somethin.
newtio.c_cc[VMIN] = 1;
newtio.c_cc[VTIME] = 0;
tcflush(sfd, TCIFLUSH);
tcsetattr(sfd, TCSANOW, &newtio);
printf("%i\n", write(sfd, MODEMDEVICE, 10));
while (!stop) {
printf(".\n"); usleep(100000);
if (!wait_flag) {
res = read(sfd, &buf, 2);
printf("%s\n", buf);
if (buf[0] == 'z') {
stop = 1;
}
wait_flag = 1;
}
}
I don't know what's going on. Using a signal_handler_IO() which I've never used before.
Basically it's supposed to get five chars and output them until just a <CR> is recieved. Well for some reason, it puts everything in the buffer and doesn't output the buffer until a CR is passed.
here's the while loop, in case i'm missing somethin.
newtio.c_cc[VMIN] = 1;
newtio.c_cc[VTIME] = 0;
tcflush(sfd, TCIFLUSH);
tcsetattr(sfd, TCSANOW, &newtio);
printf("%i\n", write(sfd, MODEMDEVICE, 10));
while (!stop) {
printf(".\n"); usleep(100000);
if (!wait_flag) {
res = read(sfd, &buf, 2);
printf("%s\n", buf);
if (buf[0] == 'z') {
stop = 1;
}
wait_flag = 1;
}
}
I don't know what's going on. Using a signal_handler_IO() which I've never used before.