TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: All
from: Bob van der Poel 76510,2203
date: 1994-05-22 21:22:14
subject: C-arg count

#: 19981 S12/OS9/68000 (OSK)
    22-May-94  21:22:14
Sb: C-arg count
Fm: Bob van der Poel 76510,2203
To: All

Help. I'm getting lost trying to write an ansi-c program using some functions
with variable args. Here is the problem...I have a general error printing
routine which really just calls fprintf(). I guess I'll have to change that to
vfprintf(), but assume that I have:

        print_error(char *, ...)
    {
         /* do the va_args stuff */
         /* set up the cursor */
         /* print the error message with vfprint() */
     /* close some files */
    }

So far, fine. But what if I want to call this from another routine...

        terminate(char *, ...)
    {
          /* call print_error() */
      /* call the exit routine */
    }

What I can't figure out is how to call print_error() from another routine which
also has a variable argument count. Guess I could just stuff the message in
terminate() into a string and just pass one arg. But there _should_ be another
way???


Press  !>

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.