469,160 Members | 2,083 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,160 developers. It's quick & easy.

FormatMessage and va_list args

Hi,

I have a function that has a variable no of arguments
(note! function shortened)

myfunction(int someID, ...)

{
va_list args;
va_start args, someID;
FormatMessage(......, &args);
va_end(args);
}

PROBLEM: formatMessage wants a pointer thus, 'va_list *Arguments'.

How can I correctly pass this all since the code above does not work.
Nov 17 '05 #1
4 2498
> myfunction(int someID, ...)

{
va_list args;
va_start args, someID;
FormatMessage(......, &args);
va_end(args);
}

PROBLEM: formatMessage wants a pointer thus, 'va_list *Arguments'. How can I correctly pass this all since the code above does not work.

What do you mean by "does not work".
What is the behavior? Does not compile? Crashes?

--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email
Nov 17 '05 #2
It works fine. But I think you may need to read FormatMessage's
documentation again.

Nov 17 '05 #3
"Mihai N." <nm**************@yahoo.com> wrote in message
news:Xn******************@207.46.248.16...
myfunction(int someID, ...)

{
va_list args;
va_start args, someID;
FormatMessage(......, &args);
va_end(args);
}

PROBLEM: formatMessage wants a pointer thus, 'va_list *Arguments'.

How can I correctly pass this all since the code above does not work.

What do you mean by "does not work".
What is the behavior? Does not compile? Crashes?


OK,

Solved.

I assumed that %s would be recognized as well. It should be %1 :)

Nov 17 '05 #4
"Mihai N." <nm**************@yahoo.com> wrote in message
news:Xn******************@207.46.248.16...
myfunction(int someID, ...)

{
va_list args;
va_start args, someID;
FormatMessage(......, &args);
va_end(args);
}

PROBLEM: formatMessage wants a pointer thus, 'va_list *Arguments'.

How can I correctly pass this all since the code above does not work.

What do you mean by "does not work".
What is the behavior? Does not compile? Crashes?


garbled output.
Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Andrej Prsa | last post: by
7 posts views Thread by Jon | last post: by
11 posts views Thread by thierrydollar | last post: by
12 posts views Thread by Volte | last post: by
1 post views Thread by skillzero | last post: by
4 posts views Thread by Tor Rustad | last post: by
8 posts views Thread by Fred | last post: by
5 posts views Thread by =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post: by
2 posts views Thread by =?Utf-8?B?U2NvdHQ=?= | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.