The file you created probably remains on the desktop without its file type appearing, but you didn't write it that way in your code. For example, if the target file is 'Business', FILE *ip; ip=fopen("Business", "r"); It should be in the form. But if the file ends with a txt extension, fopen("Business.txt", "r"); You should change it to .