All pastes #9264 Raw Edit

arg handling

public c v1 · immutable
#9264 ·published 2005-04-10 18:54 UTC
rendered paste body
#include <windows.h>#include <stdio.h>#include <shellapi.h>int __cdecl main(){   LPWSTR *szArglist;   int nArgs;   int i;   szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);   if( NULL == szArglist )   {      wprintf(L"CommandLineToArgvW failed\n");      return 0;   }   else for( i=0; i<nArgs; i++) printf("%d: %ws\n", i, szArglist[i]);// Free memory allocated for CommandLineToArgvW arguments.   LocalFree(szArglist);   return(1);}