I am very new in C++, esp. on mobile devices based on
WindowsCe/WindowsMobile. For my current project, I need to compare
commandline arguments.
My Main()-function is defined like that:
int WINAPI WinMain(HINSTANCE h, HINSTANCE, LPTSTR arg, int nCmdShow)
{
//do something
}
In the definition of the Main()-function is a long pointer for the args. How
can I compare that 'string' with a own, specified parameter?
Best regards,
Carsten Unterberg | Test-Framework
http://test-framework.blogspot.com/
The parameter is a TCHAR string, which evaluates to a CHAR or WCHAR string,
depending on the settings. Under CE though, it always is a WCHAR string.
Now, in order to compare TCHAR strings, use _tcscmp():
if(_tcscmp(arg, _T("some other text")==0)
found_it("!");
Under CE, you can also just drop the TCHAR stuff and directly use WCHAR:
... WinMain(..., WCHAR const* arg, ..) {
if(wcscmp(arg, L"some text"))
...
}
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
By the way, if you are writing a console program (but probably it is not the
case) your applicatin entry point can be wmain(int argc, WCHAR argv[]) or
_tmain(int argc, TCHAR argv).
--
Luca Calligaris (MVP-Windows Embedded)
l.calliga...@eurotech.it.nospam
www.eurotech.it
"Ulrich Eckhardt" <eckh...@satorlaser.com> ha scritto nel messaggio
news:31ndq6-...@satorlaser.homedns.org...
> Gesch�ftsf�hrer: Thorsten F�cking, Amtsgericht Hamburg HR B62 932
>