I am in the process of porting some legacy code to vxworks and am
running into problems with reading from the port.

Here is what I have:

void test_routine()
{
FILE *read;
char buffer[300];

if ((read = fopen("/tyCo/0", "r")) == NULL)
printf("Packet INPUT port did not open");
if (setvbuf(read, NULL, _IONBF, NULL)) /* unbuffered */
printf("setvbuff(read, NULL, _IONBF, NULL) failed\n");

while(1) {
fscanf(read, "\002%[^\003]\003",buffer); /* data */
printf("%s\n",buffer);
}
}

This code always lags by one packet...
* I send packet_A
--> no output
* I send packet_B
--> packet_A displayed
* I send packet_C
--> packet_B displayed
* I send packet_D
--> packet_C displayed

Any ideas?? (We are attempting to continue using this same code on our
existing system, so I'd like to avoid completely rewriting it.)

jimzat