char *strtime;
strtime = ctime (¤t_time);
fprintf( fp, "%s (%s): %s\n", strtime, ch->name, str );
fclose( fp );
char strtime[MSL];
strftime(strtime, MSL, "%a, %d %b %y %T %z", t_time);
{
FILE *fp;
char strtime[MSL];
strftime(strtime, MSL, "%x", t_time);
if ( IS_NPC(ch) || str[0] == '\0' )
return;
fclose( fpReserve );
if ( ( fp = fopen( file, "a" ) ) == NULL )
{
perror( file );
send_to_char( "Could not open the file!\n\r", ch );
}
else
{
fprintf( fp, "%s (%s): %s\n", strftime, ch->name, str );
fclose( fp );
}
fpReserve = fopen( NULL_FILE, "r" );
return;
}
fprintf( fp, "%s (%s): %s\n", strftime, ch->name, str );
fclose( fp );
char strtime[MSL];
struct tm* ptmst = localtime(& current_time);
strftime(strtime, MSL, "%m-%d-%y", ptmst);
iggystuff.c:241:5: warning: passing argument 1 of strftime from incompatible pointer type
/usr/include/time.h:56:11: note: expected char * but argument is of type char **
iggystuff.c:252:2: warning: format %s expects type char *, but argument 3 has type char **
iggystuff.c:252:2: warning: format %s expects type char *, but argument 3 has type char **
void append_file( CHAR_DATA *ch, char *file, char *str )
{
FILE *fp;
char *strtime[MAX_STRING_LENGTH];
struct tm* ptmst = localtime(¤t_time);
if ( IS_NPC(ch) || str[0] == '\0' )
return;
strftime(strtime, MAX_STRING_LENGTH, "%m-%d-%y", ptmst);
fclose( fpReserve );
if ( ( fp = fopen( file, "a" ) ) == NULL )
{
perror( file );
send_to_char( "Could not open the file!\n\r", ch );
}
else
{
fprintf( fp, "%s (%s): %s\n", strtime, ch->name, str );
fclose( fp );
}
fpReserve = fopen( NULL_FILE, "r" );
return;
}
iggystuff.c:241:5: warning: passing argument 1 of strftime from incompatible pointer type
/usr/include/time.h:56:11: note: expected char * but argument is of type char **
iggystuff.c:252:2: warning: format %s expects type char *, but argument 3 has type char **
iggystuff.c:252:2: warning: format %s expects type char *, but argument 3 has type char **
void append_file( CHAR_DATA *ch, char *file, char *str )
{
FILE *fp;
char *strtime[MAX_STRING_LENGTH];
void do_helplist (CHAR_DATA * ch, char *argument)
{
char *buf;
char buf2[MAX_STRING_LENGTH];
FILE *fp;
char clear;
if ((fp = fopen (HELP_LIST, "r")) == NULL)
return;
send_to_char ("\n\r#oHelp File requests:#n\n\r\n\r", ch);
while (getc (fp) == ';
FILE *fp;
char clear;
if ((fp = fopen (HELP_LIST, "r")) == NULL)
return;
send_to_char ("\n\r#oHelp File requests:#n\n\r\n\r", ch);
while (getc (fp) == '[')
{
buf = fread_string (fp);
sprintf (buf2, "[%s\n\r", buf);
send_to_char (buf2, ch);
clear = getc (fp);
}
fclose (fp);
return;
}
[/code]
Append file needs some minor modifications to get this to work with this
[code]
void append_file( CHAR_DATA *ch, char *file, char *str )
{
FILE *fp;
char *strtime;
if ( IS_NPC(ch) || str[0] == '\0' )
return;
if ( ( fp = fopen( file, "a" ) ) == NULL )
{
perror( file );
send_to_char( "Could not open the file!\n\r", ch );
}
else
{
strtime = ctime( ¤t_time );
strtime[strlen(strtime)-1] = '\0';
fprintf( fp, "[%s] %s: %s~\n",
new_date(current_time), ch->name, str );
fflush( fp );
fclose( fp );
}
return;
}
[/code]
my new_date function just modifies the way the date is shown!! (so you probably can use what you were using… previously)
Hope this helps, only modifications it requires is some kind of paging code…. :)
void do_bshow(CHAR_DATA* ch, char* argument){
FILE* fp;
char buf[MAX_STRING_LENGTH];
int c;
int num = 0;
fclose(fpReserve);
if((fp = fopen(PBUG_FILE, "r")) != NULL){// Filename and path of bugs file from current dir
while(!feof(fp)){
while((c = fgetc(fp)) != EOF && (buf[num] = (char)c) != '\n'
&& buf[num] != '\r' && num < (MAX_STRING_LENGTH-3))
++num;
c = fgetc(fp);
if((c != '\n' && c != '\r') || c == buf[num])
ungetc(c, fp);
buf[num++] = '\r';
buf[num++] = '\n';
buf[num ] = '\0';
send_to_pager(buf, ch);// Use send_to_char if you don't have pager code
num = 0;
}
fclose(fp);
}
fpReserve = fopen(NULL_FILE, "r");
}
How would I make it so the date and only the date (month/day/year) are displayed followed by the name and then the argument?
example:
12-15-12 (Bill): I typed who and then the mud died.
12-15-12 (Todd): I think the who command is broken. It crashed the mud.
edit to add:
I suspect I will need to do something with the void append_file function.
It appears it already shows the name but not the date stamp. any help would be nice. I know I will have to add a %s but don't know what to define it as on the next line.