Re: passing variable number of arguments to a function



On 4 Aug, 08:15, arnuld <arnuld.miz...@xxxxxxxxx> wrote:
On Aug 3, 4:49 pm, Nick Keighley <nick_keighley_nos...@xxxxxxxxxxx> wrote:

this is one of the reasons I don't use ctime() (The "American" style
format isn't to my liking either). Take a look a strftime() or even roll
your own with sprintf() and localtime().

I wrote a wrapper function to print the ctime() without newline. Tell
me what you think:

void print_time(void)
{
  char arrt[100] = {0};
  char* p = arrt;
  time_t t = time(NULL);

  strcpy(arrt, ctime(&t));
  while(*p != '\n')  printf("%c", *p++);
}

same as i thought before. I don't like the format of the string
returned by ctime() so I'd write a function that did what i wanted
in the first place! But your code looks ok.
.



Relevant Pages

  • Re: Unix equivalent of SYS$BINTIM ?
    ... Does anyone know if there is an equivalent to this in UNIX? ... I have found routines that get time from unix binary format to text ... asctime, asctime_r, ctime, ctime_r, gmtime, gmtime_r, localtime, ...
    (comp.os.vms)
  • Re: Converting from GMT
    ... CTime time); ... > call to get the current GMT offset? ... I use a COleDateTime object to format the ... > date/time for the user in their preferred format. ...
    (microsoft.public.vc.mfc)
  • Re: How to get a CTime from a string
    ... Here is a function I use for a very specific date format. ... parsing it manually, but it might give you some ideas. ... // Converts a char string US date to a CTime. ...
    (microsoft.public.vc.mfc)
  • Re: Passing a packed C structure to a c module
    ... has a different format. ... I recommend to use the ioctl module; ... wrapper function fairly large. ...
    (comp.lang.python)
  • Re: Using a files modification date in the filename
    ... I want the renamed file to be named 20060401-testme.txt ... What I can do is get the modification date using ctime, ... figure out how to format the output. ...
    (comp.lang.perl.misc)