ON compilation it shows no error but it doesnt runs !!
Perhaps you could be more descriptive than "it doesnt runs !!" What makes you think it's not working?
One problem might be that you check to see if pFile1 is NULL, and output a message if it is, but, if it is, you still use it in the loop, likely causing a crash and definitely undefined behavior.