How large is
LINESZ? How large is the buffer and how long is the
String you are trying to read? Remember a 20-letter String occupies 21 spaces in a
char*, so you need LINESZ to be 1 more than you think.
I would suggest you find somebody round there who knows lots of C. I can make a few hints, but I don't think my C is up to telling you anything definite. Sorry.
I would also suggest you check that regular expression; it appears to be something which isn't a
\n followed by a
\n. I didn't know you could use a regex after the %. Check how many characters that will match, and also whether the last line writes 3 characters at a time.
Anybody else able to help?