19.06.2009, 15:16
Look into sscanf,to find what you are wrong,and learn.
Maybe the solution.
Maybe the solution.
pawn Код:
static stock
s_printX_str[128];
#deine printX(%1,%2) \
format(s_printX_str,128,(%1),%2); \
printX_proc()
stock printX(const str[]){
format(s_printX_str,128,"%s",str);
printX_proc();
}
stock printX_proc(){
new Hour, Minute, Second;
new Year, Month, Day;
new LogFile[128], entry[128], File:Log;
gettime(Hour, Minute, Second);
getdate(Year, Month, Day);
format(LogFile, sizeof(LogFile), ServerLog, Day, Month, Year); //>>>>>> RULE 64 <<<<<<
if(!fexist(LogFile))
{ dini_Create(LogFile);
printf("New Log File: %02d-%02d-%04d.txt", Day, Month, Year);
Log = fopen(LogFile, io_append);
format(entry, sizeof(entry), "[%02d:%02d:%02d] %s\r\n", Hour, Minute, Second, s_printX_str);
fwrite(Log, entry);
fclose(Log);
} else
{ format(entry, sizeof(entry), "[%02d:%02d:%02d] % s\r\n", Hour, Minute, Second, s_printX_str);
Log = fopen(LogFile, io_append);
fwrite(Log, entry);
fclose(Log);
}
}