Hello could someone please help me figure out how to end my program when its input file ends... I have tried using a conditional, but this isnt working. Any thoughts?

Code:
while (cmd != '\n')
        {
            fscanf(infile, "%c", &cmd);
            if (cmd == EOF)
            {
                printf("check quit\n");
                prog_quit = 1;
            }