|
Hi all,
Can anyone tell me where I can get some STL for windows ce.
Thank you
|
|
|
|
|
STL is not currently supported by Windows CE (through version 3.0). I imagine the next version of the OS will support it. It all has to do with the lack of exception handling in the OS. However, this doesn't mean you are completely out of luck. Several people have done their best to tackle this problem. Check out these links:
http://www.stlport.org/
http://www.dinkumware.com/libdace.html
http://www.halcyon.com/ast/swdev.htm
Good luck,
Matt Philmon
|
|
|
|
|
Please provide me a sample for running a DOS batch file in ASP. I am stuck!
Matt
|
|
|
|
|
I would like to see an article/example on using Antialiasing when drawing 2D polygons and other shapes both outline only and filled.
|
|
|
|
|
Hi I have to write a C program to take any number of arguments of any type from the user at runtime.
I dont want to declare arrays of all the data types as that would be wastage of memory.
Is there an efficient way to input any number of arguments from the user of any type?
Please help as this is a part of my college project!!
Thanks
|
|
|
|
|
Try va_list a.k.a. variable-argument list. It's obvious, isn't it ?
HTH,
Thomas
I am a signature virus!
Help me spread and copy me to your sig!
|
|
|
|
|
Can you show me an example?
Thanks
|
|
|
|
|
Here is en example, found at MSDN:
void main( void )
{
printf( "Average is: %d\n", average( 2, 3, 4, -1 ) );
printf( "Average is: %d\n", average( 5, 7, 9, 11, -1 ) );
printf( "Average is: %d\n", average( -1 ) );
}
int average( int first, ... )
{
int count = 0, sum = 0, i = first;
va_list marker;
va_start( marker, first );
while( i != -1 )
{
sum += i;
count++;
i = va_arg( marker, int);
}
va_end( marker );
return( sum ? (sum / count) : 0 );
} HTH,
Thomas
I am a signature virus!
Help me spread and copy me to your sig!
|
|
|
|
|
Hi thanks again
But in your code you use all int arguments. Only the number of arguments is changing here.
But I want to be able to multiple type of arguments!!!
like float, char, long etc....possibly all of them!!
is that possible with va_args?
|
|
|
|
|
IMHO, unfortunately, you have to know the type at compile-time.
Regards,
Thomas
I am a signature virus!
Help me spread and copy me to your sig!
|
|
|
|
|
This is trivial. Either that or I don't understand the problem.
Your requirements:
Store variable arguments of different types at runtime.
Type is irrelevant. It will all be ascii at first.
Then you detect your types and convert them. See,
since YOU write the program, YOU decide the types.
The arguments will be in char **argv and the number of them
will be int argc. Write code to print out the
value of argc. When that works, modify it to
also print the argument strings, one by one.
You are 90 percent finished. Now for the other 90 percent...
Modify your code so that, instead of printing
the arguments, you are PARSING them. First, decide
which types you will support. Start with int and char strings.
For each argument string, check each character.
If you get to the end and find only digits, you have an int.
Call atoi() on it and store it in a freshly newed int.
Be careful of overflow - might wanna use longs and atol().
If it wasn't an int, it's a character string.
New up a buffer and strcpy it over.
To add another type, you must invent a way to detect
the type and then you must find a way to convert the
ascii string to your desired type.
|
|
|
|
|
This may not be the way you want to go about it, but...
You can write an overload function for each of the different variable types.
So, if the function for integers is... (as was written in the previous answer)
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 );
}
Then you just overload the function for other variable types such as:
long average(long first, ...)
{ ... }
double average(double first, ...)
{ ... }
Etc. Then, when the call is made, the proper function for the variable type is called for you. Voila'.
|
|
|
|
|
No that's not it.
My problem is to write a function that will take multiple types of arguments simulatneously:
eg: some_function(int arg1, float arg2, ...)
obviously the function call can have any permutation of arguments, and any number of arguments at the same time.
I need this because I am writing a function that will be able to call any function in a DLL when the user provides the name of the DLL, the name of the function and the type and number of parameters
So you see I have to write a generic function.
|
|
|
|
|
The easiest way to do this is by utilizing VARIANTS and CComVariant too!
#include < atlbase.h >
#include < stdio.h >
//------------------------------------------
void TypeArgument(const CComVariant vtArg)
//------------------------------------------
{
switch (vtArg.vt)
{
case VT_I4 :
wprintf(L"Integer Arg = %d\r\n",vtArg.lVal);
break;
case VT_BSTR:
wprintf(L"string Arg = %s\r\n",vtArg.bstrVal);
break;
case VT_EMPTY:
wprintf(L"Empty(void) Arg\r\n");
break;
default:
printf("unhandled type = %d\r\n", vtArg.vt);
break;
}
}
//------------------------------------------
BOOL AnyArguments(CComVariant vtFirst, ...)
//------------------------------------------
{
va_list vargs;
CComVariant varArg;
va_start(vargs, vtFirst);
TypeArgument(vtFirst);
while (TRUE)
{
varArg = va_arg( vargs, CComVariant);
if (varArg.vt == VT_ERROR || varArg.vt == VT_EMPTY)
break;
TypeArgument(varArg);
varArg.vt = VT_EMPTY;
}
va_end(vargs);
return TRUE;
}
//------------------------------------------
void Test()
//------------------------------------------
{
AnyArguments(CComVariant("Ali"), CComVariant(1), CComVariant(2.3));
AnyArguments(CComVariant());
}
int main()
{
Test();
return 0;
}
Even though you were able to get any combination of parameters, I don't beleive you can call any function in a DLL with that!! You need to use assembly code to be able to do that!
If you succeeded with this, please let's know so we can share the knowledge
Good luck!
Mh2!
|
|
|
|
|
Yes you are right. We used assembly code to push all the arguments onto the stack and then push the function pointer (returned by GetProcAddress) and then call the function from withing assembly code and finally pop the stack to retrieve the return value.
|
|
|
|
|
The question is somewhat confusing. By taking arguments from the user do you mean.
1) Reading program parameters from the command line.
2) Interpretting variable arguments passed to a subroutine from the caller.
3) Prompting for values to be put in.
Various respondants seem to have interpretted it various ways. I guess 1)
You'll probably loop through the parameters one by one. For each one you can try
various conversions. The simplest way is probably to use sscanf. Try a format string like
"%i%c" (tries to read the extra character to ensure the whole string was an integer).
If it's not an integer try for a float.
If it's not a float then treat is as a string.
What you do with the arguments then really depends on the object of the excercise.
You could, if you wanted, store them in a structure like --
struct myArg {
short int type;
union {
float f_val;
int i_val;
char *string_val;
}
};
|
|
|
|
|
Hi all,
Can anyone tell me where I can get some example source code for class template. for example, deque, vector source code...
Thank you
|
|
|
|
|
THE book to buy is STL Tutorial and Reference Guide by David R. Musser, et al. Foreward by Alexander Stepanov ( who wrote the STL ).
I know you're looking for a download, but if you're serious about it you probably should buy this book.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
You might want to take a look at www.stlport.org which is what I use. This is an implementation of the C++ STL. There is quite a bit to wade through, but it works quite well.
|
|
|
|
|
Does anyone know how to create a file name that has the date & time as the file name?
Thanks
|
|
|
|
|
Have a look at the localtime function. Combining time() with this and sprintf will do what you want. It has worked for me in past.
|
|
|
|
|
Thanks Rick for your help. It all works now.
|
|
|
|
|
Is there is any one who can help me to find the way so that i can persist the data in xml file on the client side after requesting it from server in a xml file before displaying it into web browser and then i can use it for later requests
Shahzad Ahmad
|
|
|
|
|
Universe Technology is just starting out and is looking for programmers. If you have skill in ASP, VBSCRIPT, HTML, Java, JavaScript, C++, C, XML or any other programming language of substance, please send me an e-mail at Alexjfink@aol.com, I will look into each applicant personally, if we like what we see, we will tell you more about Universe Technology.
|
|
|
|
|
Does anyone know how to attach IE style toolbars to a tab control, to create a toolbar similar to that of 3dsMax3.
I am able to attach toolbars to the main window, but have had no success in attaching them to dialogs or tab controls.
Is this possable?
Ant
|
|
|
|