-excuse me for my english -
i want to execute a program from an other with shellexecute and with passing multiple arguments, the problem is just the first argument is passed to the other ... what can i do :'(?
the frist
the secondCode:#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { FILE * f; if(argc>1){ f = fopen(strcat(argv[1],".txt"), "a"); if (f != NULL) { printf("%s",argv[2]); fprintf(f, "%s^%s\n",argv[2],argv[3]); printf("qsdfs"); } fclose(f); } else perror(argv[1]); getch(); return 0; }
Code:#include <windows.h> #include <shellapi.h> int main () { char **tab; tab=(char**)malloc(3*sizeof(char*)); tab[0]=(char*)malloc(10*sizeof(char)); tab[1]=(char*)malloc(10*sizeof(char)); tab[2]=(char*)malloc(sizeof(char)); strcpy(tab[0],"films"); strcpy(tab[1],"the titanic"); strcpy(tab[2],"1h 45min"); ShellExecute(NULL,"open","insert.exe",tab,NULL,SW_SHOWDEFAULT); return 0; }


LinkBack URL
About LinkBacks






Reply With Quote