简体   繁体   中英

command line arguements not recognised by int _tmain ( int argc, TCHAR* argv[] ) with unicode defined

#define UNICODE
#define WINVER 0x502
#include <stdio.h>
#include <windows.h>
#include <tchar.h>

int _tmain( int argc, TCHAR* argv[] ) {

    if ( argc > 1 && lstrcmpi( argv[1], L"install" ) == 0 ) {
        printf ( "In install\n");
    }
    else if ( argc > 1 && lstrcmpi( argv[1], L"uninstall" ) == 0 ) {
        printf ( "In Uninstall\n" );
    }
    else if ( argc > 1 && lstrcmpi( argv[1], L"start" ) == 0 ) {
        printf ( "In Start\n" );
    }
    else {
        printf ( "In else part\n" );
    }

    return 0;
}

The above code doesnt detect the command line arguements and always prints the "else" part. How to achieve what I intend to??

Am using "MINGW".. In windows XP..

thanks..

I think MINGW compiler dont define wmain altough UNICODE is defined. In your checking code use rather CommandLineToArgvW.

Ps: sorry for my English :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM