i have the following
Code:
int main()
{
    //declare variables
    char buffer[1024] = {'\0'};
    FILE *pRead = NULL;

    pRead = fopen("names.txt", "r");

    if ( pRead == NULL )
    {
        printf("file cant be opened!!\n");
        return 0;
    }

    //fscanf( pRead, "%s", buffer );

    //fread(buffer, sizeof buffer, sizeof(char), pRead);
    while ( (fscanf(pRead, "\"%[^\"]\",", buffer) != EOF) )
    //while (fread(buffer, sizeof buffer, sizeof(char), pRead) != 1)
    {

        printf("%s\n",buffer);
    }
    fclose( pRead );

    return 0;
}
the only one that did something other than a load of empty lines in a infinite loop was but it would print the text file twice before ending if it was inside the while loop or print the text file in a infinite loop outside the while loop.

if i make the buffer smaller it just throws a seg fault when it tries to read the file.

i even copied the current while loop from the official answer and it just produces empty buffer again in an infinite loop