in reply to fork IO

If the lines are fixed length then you can determine the offset position of each chunk assigned to each of your worker processes fairly easily. Then use seek to position the file pointer (after the open and before you read).

If the lines are not fixed length then you need to find the position of each chunk by scanning the file (use tell). I suggest you only do this once in the primary (first) program and pass the offset and length to the children.

On Windows you might be better using overlapped IO, but that requires the Win32 API.