我有一个关于通过命令行传递参数的问题。
我的main()
看起来像
int main(int argc, char **argv){
int b, d, n, flag;
char *init_d, tst_dir[100];
argv++;
init_d=*(argv++);
//printf(); <--------What do I have to do to init_d so that I can print it later?
如果argv
是指向指针数组的指针,我会将init_d
分配给指针所指向的值?(如果这有道理的话)
I assume I have to get that value into a character array in order to print it out but if I don t know the size of the "string" I am passing in, I am not sure how to achieve this. For instance if i run my code ./myprogram hello compared to ./myprogram alongerinput