// // On our way out, be sure to close the error file // ... and remind them of how many errors they created // plExportLogErrorMsg::~plExportLogErrorMsg() { if ( fErrfile ) { fprintf(fErrfile, "\n%d total number of error!!!! ", fNumberErrors); if ( fNumberErrors > 10 ) if ( fNumberErrors > 20 ) if ( fNumberErrors > 50 ) fprintf(fErrfile, "(CRISIS CRISIS!)"); else fprintf(fErrfile, "(which is a disaster!)"); else fprintf(fErrfile, "(which is way too many!)"); fclose(fErrfile); } #ifdef ERRORLOG_ALWAYS_WRITE_SOMETHING else { fErrfile = hsFopen(fErrfile_name, "wt"); setbuf(fErrfile, nil); fprintf(fErrfile, "No errors found! Good job."); fclose(fErrfile); } #endif // ERRORLOG_ALWAYS_WRITE_SOMETHING }
// // Write a string to the Error Log File, be sure its open before using // void plExportLogErrorMsg::IWriteErrorFile(const char* label, const char* msg) { //make sure that there is a filename if (fErrfile_name[0] != '\0') { // do we have it open, yet? if ( !fErrfile ) { // must be the first write... open the error file fErrfile = hsFopen(fErrfile_name, "wt"); setbuf(fErrfile, nil); fNumberErrors = 0; } fprintf(fErrfile, "%s: %s\n", label, msg); fNumberErrors++; // oh, boy... another error to count } // Check to see if we are running an export server // If so, then pass the update on to the export server GUP* exportServerGup = OpenGupPlugIn(Class_ID(470000004,99)); if(exportServerGup) { exportServerGup->Control(-5); // means next control will be error msg char buf[1024]; sprintf(buf, "%s: %s", label, msg); exportServerGup->Control((DWORD)buf); exportServerGup->Control(-7); // signal that we're done sending this update sequence } }
bool hsBufferedStream::Open(const char* name, const char* mode) { hsAssert(!fRef, "hsBufferedStream:Open Stream already opened"); fRef = hsFopen(name, mode); if (!fRef) return false; SetFileRef(fRef); #ifdef LOG_BUFFERED fBufferHits = fBufferMisses = 0; fBufferReadIn = fBufferReadOut = fReadDirect = fLastReadPos = 0; delete [] fFilename; fFilename = hsStrdup(name); fCloseReason = nil; #endif // LOG_BUFFERED return true; }
bool hsUNIXStream::Open(const char *name, const char *mode) { fPosition = 0; fRef = hsFopen(name, mode); return (fRef) ? true : false; }