This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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.
Although that looks like a regular expression, it's not; it's just a character class (a negated one, because of the "^"). That's a legal call to fscanf; it will read everything up to and including a newline, and put everything but the newline into "linein" (which better be a pointer to a large-enough char array).
But if this is real code, I'm not quite sure what it's trying to do. The fgets() reads up to LINESZ characters, but stops at a newline -- generally it's going to read one line of text. If it successfully reads a line, then the fscanf call immediately reads another line into the same buffer, and so the line read by fgets() is ignored. That does sound like the "skipping lines" problem that the poster mentions.
Unless there are lines that are deliberately supposed to be skipped, my suggestion is to comment that fscanf() call out, recompile, and run the program again -- that may fix all your problems right there.