fseek(fp, 0, SEEK_END); nBuf = ftell(fp); [...] if ((cpBuf = (char *)malloc(sizeof(char) * nBuf+1)) == NULL) { ePerl_SetError("Cannot allocate %d bytes of memory", nBuf); CU(NULL); } fseek(fp, 0, SEEK_SET); if (fread(cpBuf, nBuf, 1, fp) == 0) { #### fprintf(fp, "%c", c);