When using the ",ccs=STRING" extension in the second argument of fopen, and STRING is not a recognized character set then the file descriptor is not closed before returning the error. Andreas.