If you want to keep it simple stupid:
#include <stdio.h>
void process_line(const char* line)
{
}
void test()
{
FILE* f = fopen("myfile.txt", "r");
if (f)
{
for (int i=0; i<3; ++i)
{
const int MAX_LINE_LENGTH = 0x100;
char line[MAX_LINE_LENGTH];
if (!fgets(line, sizeof(line), f))
break;
int len = strlen(line);
if (len>0 && line[len-1]=='\n')
line[len-1] = 0;
process_line(line);
}
fclose(f);
}
}