Sending arguments to an excutable

S

sigma1035

Hi All,

I am not sure if this is the right group, but a have an executable
(written in C++) and I am trying to pass arguments into it.

i.e. \\server\simple.exe 10

will work in the Start->run

But when I send it as a <A HREF="\\server\simple.exe 10"> Link </A> in
a HTML e-mail, no luck. It says it could not find the file or starts
it without passing in any arguments.

I have been looking all over for help (I have tried simple.exe?10 as
well), but not nothing has worked so far. Any help would be much
appreciated.

Regards,

Marek
 
V

Victor Bazarov

I am not sure if this is the right group,

It's not.
but a have an executable
(written in C++) and I am trying to pass arguments into it.

i.e. \\server\simple.exe 10

will work in the Start->run

You must be doing something right AFA C++ is concerned.
But when I send it as a <A HREF="\\server\simple.exe 10"> Link </A> in
a HTML e-mail, no luck. It says it could not find the file or starts
it without passing in any arguments.

I have been looking all over for help (I have tried simple.exe?10 as
well), but not nothing has worked so far. Any help would be much
appreciated.

Post your HTTP question to comp.infosystems.www.authoring.cgi. You need
to learn the "common gateway interface" (CGI), and it's not part of C++
language.

V
 
I

Ioannis Vranos

Hi All,

I am not sure if this is the right group, but a have an executable
(written in C++) and I am trying to pass arguments into it.

i.e. \\server\simple.exe 10

will work in the Start->run

But when I send it as a <A HREF="\\server\simple.exe 10"> Link </A> in
a HTML e-mail, no luck. It says it could not find the file or starts
it without passing in any arguments.

I have been looking all over for help (I have tried simple.exe?10 as
well), but not nothing has worked so far. Any help would be much
appreciated.


How do you try to detect the arguments inside the application?


Also a better newsgroup to consult is microsoft.public.dotnet.languages.vc newsgroup.

Also better use the public MS news server for that one:

msnews.microsoft.com
 
S

sigma1035

Thank you both for the information. As for the arugments, I am just
using main(int argc, char *argv[]). It will work if I just run it from
the start menu.
 
I

Ioannis Vranos

Thank you both for the information. As for the arugments, I am just
using main(int argc, char *argv[]). It will work if I just run it from
the start menu.

As far as I know it is not allowed to use spaces inside a link. Have you tried the following?

<A HREF="\\server\simple.exe%2010"> Link </A>
 
S

sigma1035

I hadn't thought of that. It looks as though it took it literally
rather than interpretting it....
 
I

Ioannis Vranos

I hadn't thought of that. It looks as though it took it literally
rather than interpretting it....


After some experiments I think one way you can do it, is by entering the arguments you
want from inside the program rather than the command line. For example:


#include <iostream>
#include <vector>
#include <cstdlib>


int main()
{
using namespace std;

string arg;

cout<<"\nGive input argument: ";

getline(cin, arg);

// Process arg...

system("pause");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top