I need help with this C++ function.
VOID __cdecl Buffer(LPCTSTR lpInput, ...)
{
//some code
}
What is the meaning of the "..." as part of its input parameters?
I know the meaning of __cdecl but got stuck with the "..."
This code can be compiled and executed so its not some typing error or fill-in-the-blank thingy.
Anyone can help?
Originally posted by Xcert:I need help with this C++ function.
VOID __cdecl Buffer(LPCTSTR lpInput, ...)
{
//some code
}
What is the meaning of the "..." as part of its input parameters?
I know the meaning of __cdecl but got stuck with the "..."
This code can be compiled and executed so its not some typing error or fill-in-the-blank thingy.
Anyone can help?
what does _cdecl do? and what is LPCTSTR lpInput for?
Never seen a code like tht before.Is it some type of header file?
Originally posted by dumbdumb!:what does _cdecl do? and what is LPCTSTR lpInput for?
simply put...__cdecl is more for declaring functions in C language. Its a default calling convention.
The C programming that we are taught is not really C.Its C++...which is an improved version of C....and so a lot of background things have already been done for us in C++.
LPCTSTR is long pointer string constant.
Originally posted by Alucard101:Never seen a code like tht before.Is it some type of header file?
not surprising for the kind of C++ programming that are being taught in polys. Good enough for concepts and basic programming skills...Not quite there for serious programming.
Its in a .C source file.
Tried removing the .... and see what happens? I never see ... as part of the parameters.
Also try writing some codes that doesn't use LPCTSTR lpInput parameters. The ... might start throwing some errors.
Originally posted by Xcert:I need help with this C++ function.
VOID __cdecl Buffer(LPCTSTR lpInput, ...)
{
//some code
}
What is the meaning of the "..." as part of its input parameters?
I know the meaning of __cdecl but got stuck with the "..."
This code can be compiled and executed so its not some typing error or fill-in-the-blank thingy.
Anyone can help?
Found it through Google.
http://msdn2.microsoft.com/en-us/library/k64h826d(VS.80).aspx
It's known as the ellipsis notation which allows the user (as in the script that uses that function) to insert a variable number of parameters into the function. A useful application for this would be a function that calculates the sum of all the parameters given.
Originally posted by Xcert:not surprising for the kind of C++ programming that are being taught in polys. Good enough for concepts and basic programming skills...Not quite there for serious programming.
Its in a .C source file.
Walau, don't so bad leh, unker. If like that I go in poly learn basic stuff nia meh?
Thanks for the MSDN link.
if U know how to get info from MSDN...I dont think C++ programming in poly will be something difficult for U.