Need quikfix

Ok I have a program that accepts input from a file. it reads in inputs and is supposed to close automagically when it sees the number '42'. Only problem, I can read the input just dont know how to look for 42.