Click here to Skip to main content
15,917,637 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Position cursor on last item in CListCtrl (reportmode) Pin
Wim Jans5-Aug-03 6:43
Wim Jans5-Aug-03 6:43 
General__gc Pin
devvvy5-Aug-03 1:31
devvvy5-Aug-03 1:31 
GeneralDataGrid problem Pin
siddharth235-Aug-03 1:29
siddharth235-Aug-03 1:29 
GeneralRuntime error Pin
si_695-Aug-03 1:09
si_695-Aug-03 1:09 
GeneralCreating Outlook Express button Pin
beside5-Aug-03 0:44
sussbeside5-Aug-03 0:44 
GeneralRe: Creating Outlook Express button Pin
Eugene Pustovoyt5-Aug-03 1:57
Eugene Pustovoyt5-Aug-03 1:57 
GeneralRe: Creating Outlook Express button Pin
beside5-Aug-03 2:21
sussbeside5-Aug-03 2:21 
GeneralVariable number of arguments... Pin
Anonymous5-Aug-03 0:33
Anonymous5-Aug-03 0:33 
I've written a function which is prototyped like this:

void myfunc(char *first, ...)

I'm using the va_arg, va_end, va_start macros to access the variable-argument list but I have to specify a terminator. Is there any way I can avoid having to specify the terminator?

Here is example from MSDN:

int average( int first, ... )
{
   int count = 0, sum = 0, i = first;
   va_list marker;

   va_start( marker, first );     /* Initialize variable arguments. */
   while( i != -1 )
   {
      sum += i;
      count++;
      i = va_arg( marker, int);
   }
   va_end( marker );              /* Reset variable arguments.      */
   return( sum ? (sum / count) : 0 );
}

where the function must be called like this:

printf( "Average is: %d\n", average( 2, 3, 4, -1 ) );

Note the "-1" parameter!

If I have to do this, how does printf() avoid it?
GeneralRe: Variable number of arguments... Pin
Ryan Binns5-Aug-03 0:41
Ryan Binns5-Aug-03 0:41 
GeneralRe: Variable number of arguments... Pin
Ted Ferenc5-Aug-03 0:47
Ted Ferenc5-Aug-03 0:47 
GeneralRe: Variable number of arguments... Pin
HPSI5-Aug-03 0:55
HPSI5-Aug-03 0:55 
General.Net proj Pin
Nilesh K.5-Aug-03 0:29
Nilesh K.5-Aug-03 0:29 
GeneralRe: .Net proj Pin
HPSI5-Aug-03 1:06
HPSI5-Aug-03 1:06 
GeneralLeaks font resourse at use CIpAddressCtrl Pin
Eugene Pustovoyt5-Aug-03 0:27
Eugene Pustovoyt5-Aug-03 0:27 
GeneralRe: Leaks font resourse at use CIpAddressCtrl Pin
HPSI5-Aug-03 1:00
HPSI5-Aug-03 1:00 
GeneralRe: Leaks font resourse at use CIpAddressCtrl Pin
Eugene Pustovoyt5-Aug-03 1:42
Eugene Pustovoyt5-Aug-03 1:42 
GeneralPasting DLL code into SDI workspace Pin
Member 4853715-Aug-03 0:17
Member 4853715-Aug-03 0:17 
Questionwebbrowser problem???? Pin
xxhimanshu4-Aug-03 23:57
xxhimanshu4-Aug-03 23:57 
GeneralRe: Get current logged on user Pin
Toni784-Aug-03 23:16
Toni784-Aug-03 23:16 
GeneralRe: Get current logged on user Pin
Didi735-Aug-03 0:39
Didi735-Aug-03 0:39 
GeneralRe: Get current logged on user Pin
Toni785-Aug-03 22:29
Toni785-Aug-03 22:29 
GeneralGet current logged on user Pin
Didi734-Aug-03 23:13
Didi734-Aug-03 23:13 
Generalmsdn 2003 download Pin
Abhi@Work4-Aug-03 23:09
Abhi@Work4-Aug-03 23:09 
GeneralRe: msdn 2003 download Pin
Toni784-Aug-03 23:13
Toni784-Aug-03 23:13 
GeneralRe: msdn 2003 download Pin
Abhi@Work4-Aug-03 23:19
Abhi@Work4-Aug-03 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.