Advertisement

04.29.2008 at 07:16PM PDT, ID: 23364235
[x]
Attachment Details

Execute console application with parameter from c program.

Asked by CSLEEDS in C Programming Language, C++ Programming Language

Tags:

hi all, i'm trying to execute a console application(written in vb.net vs2003) with a single parameter from a c progam, the code of my c program is as attached, the SendAlert.exe is working if i'm execute it from the run command with the parameter i added, but it just refuse to work when trying to execute it from the c program.

by using system(str2), the following msg returned:
'C:\CPP\SendAlert.exe' is not recognized as an internal or external command, operable program or batch file.
Press any key to continue
this is the command line executed:"C:\CPP\SendAlert.exe" Packaged tester 30 april 08

for ShellExecute(NULL, "open", str2, NULL, NULL, SW_SHOWNORMAL); and WinExec ( str2, SW_SHOWNORMAL);
nothing has been done

any ideas?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
void main()
{
	char str1[255];
	char str2[]="\"";
	GetCurrentDirectory (255,str1);
	strcat(str1,"\\SendAlert.exe\" ");
	strcat(str2,str1);
	char str3[]="Packaged tester 30 april 08";
	strcat(str2,str3);
	system(str2);
	//ShellExecute(NULL, "open", str2, NULL, NULL, SW_SHOWNORMAL); 
	//WinExec ( str2, SW_SHOWNORMAL);
}
[+][-]04.29.2008 at 07:28PM PDT, ID: 21467730

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C Programming Language, C++ Programming Language
Tags: C, C++
Sign Up Now!
Solution Provided By: jkr
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.29.2008 at 07:48PM PDT, ID: 21467785

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628