You can verify that the file name has .txt in it. You probably shouldn't, but you can -- just search for .txt in argv[1] and argv[2]; if you find it hooray, if you don't boo.