All pastes #745568 Raw Edit

Something

public cpp v1 · immutable
·published 2007-10-22 14:44 UTC
rendered paste body
(IN GAME.H)// function definitions to give cpp files access to each other.    void logString(char *out);    void setLog();// The system structure will track most of the global system variables.    struct system_data    {        FILE    *logFile;        int     port;        string  mudName;    };    typedef struct system_data SYSTEM_DATA;    extern struct system_data sys;    <STRIPPED>(IN GAME.CPP)nt main(int argc,char **argv){    int i;//    SYSTEM_DATA *sys;    sys.port = 3333;    sys.mudName = "Rift of Fate";    perror("GOT HERE!");<STRIPPED (the above perror never goes off, btw)>(IN LOG.CPP)void logString(char *out){//    SYSTEM_DATA *sys;    FILE * logFile;    int i;    time_t now;    time(&now);    struct tm *local = localtime(&now);  	//logFile = fopen (sys->logFile, "a");    if(!sys.logFile){        perror("logString: logFile failed to open!");        exit(1);    }    fprintf(sys.logFile, "%d/%d/%d ", local->tm_mon, local->tm_mday, local->tm_year);    fprintf(sys.logFile, "%d:%d:%d - %s\n\0", local->tm_hour, local->tm_min, local->tm_sec, out);/*    fclose(logFile);    if(logFile){        perror("logString: logFile failed to CLOSE!?");        exit(1);    }*/    return;}