Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Feb 21, 2019 8:20 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Apr 30, 2006 3:37 pm 
Je me posais une petite question (conne, très certainement).
Pourquoi ne pas utiliser vfprintf dans la fonction raydium_log (log.c) ?

Je verrais bien un truc du genre :
Code:
void raydium_log(char * format, ...)
{
  va_list arg;

  va_start(arg, format);
  vfprintf(stdout, format, arg);
  if(raydium_log_file) vfprintf(raydium_log_file, format, arg);
  raydium_console_line_add(format, arg);
  va_end(arg);
}


En ce qui concerne raydium_console_line_add (console.c), un vsnprintf et strncpy seraient préférables également à mon humble avis.
Voilà voilà :)


--
guitou


Top
  
 
 Post subject:
PostPosted: Tue May 09, 2006 11:39 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2590
Location: gnniiiii (Scrat)
Eh bien pourquoi pas ! On évite effectivement quelques mauvaises surprises dûes à des débordements. Tu souhaites t'en charger ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 3:29 pm 
Offline

Joined: Sun Apr 30, 2006 8:55 pm
Posts: 22
Location: Plaisir (et oui, ça fait plaisir)
Eventuellement oui. Je vais faire quelques vérifications tout de même, j'ai cru lire un truc dans le man qui me plait moyen.

Quote:
int vprintf(const char *format, va_list ap);
int vfprintf(FILE *stream, const char *format, va_list ap);
int vsprintf(char *str, const char *format, va_list ap);
int vsnprintf(char *str, size_t size, const char *format, va_list ap);

The functions vprintf, vfprintf, vsprintf, vsnprintf are equivalent to the functions printf, fprintf, sprintf, snprintf, respectively,
except that they are called with a va_list instead of a variable number of arguments. These functions do not call the va_end macro.
Consequently, the value of ap is undefined after the call. The application should call va_end(ap) itself afterwards.


--
guitou


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 6:22 am 
Offline

Joined: Sun Apr 30, 2006 8:55 pm
Posts: 22
Location: Plaisir (et oui, ça fait plaisir)
(la suite de ce thread est dans http://memak.raydium.org/viewtopic.php?t=351)

--
guitou


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group