🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4883

General 'C' Preprocessor Question

#4883
From: Jim Bittman
Date: Tue, 26 Feb 1991 08:28
15 lines
998 bytes
Is it possible to use the preprocessor to handle a variable number
of arguments?  Let's say that I want to redefine "printf" to "sprintf".
Is this possible?
  #define printf(a) sprintf(mychbuf,a)
This works just fine if there are no arguments, such as:
  printf("Hello World\n");
This correctly processes to:
  sprintf(mychbuf,"Hello World\n");

I have checked the literature, but nothing seems to touch on this
subject.  Please post or e-mail any responses, I read this group
religously, and really like it!

Thank you.
Jim Bittman, jmbj@grebyn.com
Technical Details
Message-ID: <1991Feb26.082837.5618@grebyn.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!grebyn!jmbj

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!grebyn!jmbj
From: jmbj@grebyn.com (Jim Bittman)
Newsgroups: comp.os.msdos.programmer
Subject: General 'C' Preprocessor Question
Keywords: Variable number of arguments
Message-ID: <1991Feb26.082837.5618@grebyn.com>
Date: 26 Feb 91 08:28:37 GMT
Organization: Grebyn Corporation
Lines: 15