sprintf replacement

This is a discussion on sprintf replacement within the C++ Programming forums, part of the General Programming Boards category; I am trying to write myself a sprint replacement, but I am having trouble declaring multiple arguments. void sprintf(char* var, ...

  1. #1
    Unregistered
    Guest

    sprintf replacement

    I am trying to write myself a sprint replacement, but I am having trouble declaring multiple arguments.

    void sprintf(char* var, const char* format, ...);

    How exactly can I handle mutiple arguments? I know how to handle var and format but not the multiple argument list I am supposed to use.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Look up va_start, va_end, and va_arg.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sprintf overflows my buffer -- why?
    By Lasston in forum C Programming
    Replies: 26
    Last Post: 06-20-2008, 04:33 PM
  2. NeHe Glaux replacement??
    By Razorblade Kiss in forum Game Programming
    Replies: 4
    Last Post: 02-25-2006, 02:30 AM
  3. sprintf Wrapping, a tough one
    By AdmiralKirk in forum C++ Programming
    Replies: 3
    Last Post: 02-03-2006, 09:43 AM
  4. sprintf() giving crash to program!!
    By maven in forum C Programming
    Replies: 4
    Last Post: 01-01-2006, 11:26 AM
  5. Sprintf
    By Trauts in forum C++ Programming
    Replies: 10
    Last Post: 01-15-2003, 12:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21