Well, have you RTFM on fopen? Specifically have you read about fopen's return value?