Manca l'apice dopo .txt alla riga 18 ($fd=fopen... ).