xref: /reactos/modules/rostests/tests/args/args.c (revision c2c66aff)
1 #include <stdarg.h>
2 #include <string.h>
3 #include <stdio.h>
4 #include <windows.h>
5 
6 HANDLE OutputHandle;
7 HANDLE InputHandle;
8 
debug_printf(char * fmt,...)9 void debug_printf(char* fmt, ...)
10 {
11    va_list args;
12    char buffer[255];
13 
14    va_start(args,fmt);
15    vsprintf(buffer,fmt,args);
16    WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
17    va_end(args);
18 }
19 
20 
main(int argc,char * argv[])21 int main(int argc, char* argv[])
22 {
23    int i;
24 
25    AllocConsole();
26    InputHandle = GetStdHandle(STD_INPUT_HANDLE);
27    OutputHandle =  GetStdHandle(STD_OUTPUT_HANDLE);
28 
29    printf("GetCommandLineA() %s\n",GetCommandLineA());
30    debug_printf("GetCommandLineA() %s\n",GetCommandLineA());
31    debug_printf("argc %d\n", argc);
32    for (i=0; i<argc; i++)
33      {
34         debug_printf("Argv[%d]: %x\n",i,argv[i]);
35         debug_printf("Argv[%d]: '%s'\n",i,argv[i]);
36      }
37    return 0;
38 }
39 
40