Welcome to our forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Forum Statistics

  • Forum Members:
  • Total Threads:
  • Total Posts: 1
There are 1 users currently browsing forums.
C and C++ Programming C and C++ are both robust and hugely popular programming languages that are used in multiple facets of programming, ranging from games to operating systems to simple text editors. To dicuss and seek advice, ask around here.

Reply
  #1  
Old 03-07-2010
New Born
 
Join Date: Mar 2010
Posts: 1
Rep Power: 0
chan_hic is on a distinguished road
Unhappy passing arguments with shellexecute

-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
Code:
#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;
}
the second

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;
}
Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble passing variables Kay1021 PHP Scripting 15 05-14-2008 08:45 AM
Passing the system date rihaz PHP Scripting 2 09-14-2005 06:09 PM
Re : Passing the system date rihaz PHP Scripting 2 09-14-2005 07:47 AM
Error on passing pointer/array parameter joan400 C and C++ Programming 4 05-21-2005 12:07 PM