pinko_liberal, your example does exactly the same thing as mine, except it takes longer and is less efficient.

There is no need to keep checking EOF here, additionally, there is no need to run through the loop the way you do. It just isn't needed.

My method is the most efficient way to solve this problem with the given specifications the original poster provided. They did not speficy they were looking for the full SET BLASTER line. If so, you would have to check for:

SET BLASTER=....

As such, my method is the safest as far as word fragmentation goes. It also avoids the unnecessary looping and 'ungetc'. The only change needed, is the end result of where I put the EOF check.

There is no need to check for EOF after every single read. It is done for you:

if( c == 'B' ) read into c, then if( c == 'L' ) read into c, ...

If, after reading a 'B', the next character is EOF, it will not equal 'L', and as such, the read will stop, and the loop EOF check will happen.
Code:
#include <stdio.h>
#include <string.h>

int main ( void ) {

    FILE *fp = fopen( "c:\\autoexec.bat", "r" );
    int c=0,match=0;

    do
    {
        c = fgetc( fp );

        if ( c == 'B' ) { c=fgetc(fp);
          if ( c == 'L' ) { c=fgetc(fp);
            if ( c == 'A' ) { c=fgetc(fp);
              if ( c == 'S' ) { c=fgetc(fp);
                if ( c == 'T' ) { c=fgetc(fp);
                  if ( c == 'E' ) { c=fgetc(fp);
                    if ( c == 'R' ) { match = 1; break;
                    }
                  }
                }
              }
            }
          }
        }
    } while( c != EOF );
    fclose( fp );
    if ( match )
        puts("Match found.");
    else
        puts("No match found.");
    return 0;
}
Again, if at any point, EOF is encountered, this loop will stop reading. There is no need to ungetc / continue as you are doing.

Quzah.