Ask coding questions

← Back to all posts
Find a Solution
OmPrakash6 (5)

A random ASCII character is received every 100ms. We need to find a sequence of "GLROX" characters. There can be other characters in between! Once found- call a Found function and wait for the sequence again, if not found then wait until this sequence is found. If a new character does not come in 2 seconds call Timeout function and wait for the whole "GLROX" again even if previously received part of the sequence. The Process function which is your entry point is called every 100ms.Write a code in C

Comments
hotnewtop
mwilki7 (1137)

is this a question?

mwilki7 (1137)

Does the code in the question use something along the lines of:

char *buf
while (socket.read(buf) != NULL)
{
    // other stuff here
}

?