fixed perror stuff by adding <stdio.h>