function with ... as its parameter?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: function with ... as its parameter?

  1. #1
    Join Date
    Jan 2010
    Location
    Malaysia
    Posts
    15

    function with ... as its parameter?

    Any one know what is means by

    void Log(int nLevel,LPCTSTR lpszFormat,...)
    {

    }

    May I know what can ... inside the above function refering to?

  2. #2
    Join Date
    Jul 2002
    Posts
    2,505

    Re: function with ... as its parameter?

    This is the same as printf parameters. Number of parameters is defined by format specifiers in the lpszFormat.

  3. #3
    Join Date
    Nov 2005
    Posts
    121

    Re: function with ... as its parameter?

    You can use va_start() to initialize variable argument list pointer and then va_arg() to get next argument in variable argument list.

    Refer http://msdn.microsoft.com/en-us/libr...d8(VS.71).aspx for example.
    Last edited by funwithdolphin; September 2nd, 2010 at 02:03 AM.
    There are 10 types of people in this world, those who understand binary and those who do not!!

  4. #4
    Join Date
    Jan 2010
    Location
    Malaysia
    Posts
    15

    Re: function with ... as its parameter?

    Thanks to Alex F.

    Also thanks to funwithdolphin for showing me a clear example.Now I know how to use it. Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center