R
Romulo Carneiro
Hi,
I'm programming in Windows XP and i'm trying to get all arguments of
some application, but i only have gotten five argv. When i put more
then five(5), it didn't display.
=>Input Command Line:
Argumentos.exe MyName Arg_1 Arg_2 Arg_3 Arg_3 Arg_4 Arg_5 Arg_6
=>output of my program:
Size of Argc:8
Size of Argv: 4
i:0 - Argumentos.exe
i:1 - MyName
i:2 - Arg_1
i:3 - Arg_2
i:4 - Arg_3
=>Source code of my program:
//Program to get the list of command line arguments.
#include "stdafx.h"
#include "stdio.h"
#include "process.h"
int main(int argc, char* argv[])
{
FILE *fp;
// Criando uma aplicação
//Open a File teste.txt
fp = fopen("teste.txt", "w");
//Print the
fprintf( fp, "Size of Argc:%d\n", argc );
int y = MemorySize(argv);
//int y = sizeof(*argv);
fprintf( fp, "Size of Argv: %d\n", y );
int x = sizeof(argc);
for (int i = 0; i<= y; i++)
{
fprintf(fp, "i:%d - %s\n", i, argv);
}
fclose(fp);
system("type teste.txt");
return 0;
}
I'm programming in Windows XP and i'm trying to get all arguments of
some application, but i only have gotten five argv. When i put more
then five(5), it didn't display.
=>Input Command Line:
Argumentos.exe MyName Arg_1 Arg_2 Arg_3 Arg_3 Arg_4 Arg_5 Arg_6
=>output of my program:
Size of Argc:8
Size of Argv: 4
i:0 - Argumentos.exe
i:1 - MyName
i:2 - Arg_1
i:3 - Arg_2
i:4 - Arg_3
=>Source code of my program:
//Program to get the list of command line arguments.
#include "stdafx.h"
#include "stdio.h"
#include "process.h"
int main(int argc, char* argv[])
{
FILE *fp;
// Criando uma aplicação
//Open a File teste.txt
fp = fopen("teste.txt", "w");
//Print the
fprintf( fp, "Size of Argc:%d\n", argc );
int y = MemorySize(argv);
//int y = sizeof(*argv);
fprintf( fp, "Size of Argv: %d\n", y );
int x = sizeof(argc);
for (int i = 0; i<= y; i++)
{
fprintf(fp, "i:%d - %s\n", i, argv);
}
fclose(fp);
system("type teste.txt");
return 0;
}