I need to read data from a flat file [find below] into a linked list. Each line is a record and each record needs to be read into a different node. After I open the file using fopen(), I have the following problem:

1) How do I move from the first line of the file to the second when Im reading the data in the file?

The flat file is organized in the following manner:

username, password, access
username2, password2, access2
username3, password3, access3
...
...
...

So what your saying is the fields are comma separated and the records are newline separated?

So what your saying is the fields are comma separated and the records are newline separated?

yup.

This is a very simple version of how it might work

#include <stdio.h>
#include <stdlib.h>

char ch[100];

int main(int argc, char**argv)
{
	FILE *fd;
	if (!(fd = fopen("testfile", "r")))
	{
		fputs("could not open testfile!\n", stderr);
		exit(EXIT_FAILURE);
	}

	fscanf(fd, "%s", ch);
	fprintf(stdout, "string->%s\n", ch);
	fscanf(fd, "%s", ch);
	fprintf(stdout, "string->%s\n", ch);
	fscanf(fd, "%s", ch);
	fprintf(stdout, "string->%s\n", ch);
	fscanf(fd, "%s", ch);
	fprintf(stdout, "string->%s\n", ch);

	fclose(fd);

	exit(EXIT_FAILURE);
}

the data file

this,is,line,one
this,is,line,two
this,is,line,three
this,is,line,four