intercepting functions with a variable argument list

This is a discussion on intercepting functions with a variable argument list within the C++ Programming forums, part of the General Programming Boards category; I've got a function with a variable list of arguments: Code: Execute(int arg1, int arg2, int arg3, int arg4, int ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    2

    intercepting functions with a variable argument list

    I've got a function with a variable list of arguments:

    Code:
    Execute(int arg1, int arg2, int arg3, int arg4, int argLast, ...)
    I want to write another function that intercepts Execute. I want it to have the same argument list and pass all these arguments to Execute. For example something like this:

    Code:
    myExecute(int arg1, int arg2, int arg3, int arg4, int argLast, ...) {
    printf("I will call execute now");
    Execute(arg1,arg2,arg3,arg4,argLast, ...);
    printf("I have called execute");
    }
    Is there a way to do that?

    I was thinking of using the va_list but there's no ExecuteV function that would simply allow me to pass the whole va_list.
    Please help...

  2. #2
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    I think vsprintf is what you want, I haven't used it in a long time but I'm sure you can google and figure it out

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    2
    no, unfortunately it's a different function and it doesn't have a "v" version, like vsprintf.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 06:36 AM
  2. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM
  3. I'll have a Variable argument list to go...
    By SMurf in forum C Programming
    Replies: 6
    Last Post: 02-27-2003, 02:02 PM
  4. Variable Argument Functions
    By genghis in forum C++ Programming
    Replies: 6
    Last Post: 02-10-2002, 02:01 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 11:21 PM

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