project doesn't build .exe?
-
Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have.
#include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) { system("setsdwperm.bat " + *argv[1]); }
I got the project on the add new project dialog: Visual C++ -> General -> Empty Project When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change? -
Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have.
#include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) { system("setsdwperm.bat " + *argv[1]); }
I got the project on the add new project dialog: Visual C++ -> General -> Empty Project When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change?eggsovereasy wrote:
system("setsdwperm.bat " + *argv[1]);
oh my god !!! when you want to concatenate strings, you mustn't use the + operator !!! you have to use
strcat()
. moreover,system()
is deprecated if you're targetting your code for a given plateform (for Windows, you should preferShellExecute()
orCreateProcess()
for instance).
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have.
#include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) { system("setsdwperm.bat " + *argv[1]); }
I got the project on the add new project dialog: Visual C++ -> General -> Empty Project When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change?Probably you are looking at the wrong place ([ADDED]provided you didn't make errors, see toxcct reply...). You ca check the value of the 'Output Directory' setting inside the 'Configuration Properties->General' window (Menu Project Properties). Or, if you prefer, you can check it in the linker command line (/OUT option). By default (I'm talking about VS2005) the executable is inside the 'debug' (or 'release') subfolder of the solution one. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Probably you are looking at the wrong place ([ADDED]provided you didn't make errors, see toxcct reply...). You ca check the value of the 'Output Directory' setting inside the 'Configuration Properties->General' window (Menu Project Properties). Or, if you prefer, you can check it in the linker command line (/OUT option). By default (I'm talking about VS2005) the executable is inside the 'debug' (or 'release') subfolder of the solution one. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
Yeah, with C# projects it puts all the compiled files in Solution Dir\Project Dir\Output Dir, but with this it was in Solution Dir\Output Dir. Thanks.
-
eggsovereasy wrote:
system("setsdwperm.bat " + *argv[1]);
oh my god !!! when you want to concatenate strings, you mustn't use the + operator !!! you have to use
strcat()
. moreover,system()
is deprecated if you're targetting your code for a given plateform (for Windows, you should preferShellExecute()
orCreateProcess()
for instance).
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
Ok, everything I try throws exceptions and I can't use the debugger with it? Any suggestions on how I would do this? all I need to do is combine "setsdwperm.bat " with the first argument and execute it.
-
Ok, everything I try throws exceptions and I can't use the debugger with it? Any suggestions on how I would do this? all I need to do is combine "setsdwperm.bat " with the first argument and execute it.
#include <stdio.h>
#include <stdlib.h>int _tmain(int argc, TCHAR* argv[]) {
TCHAR pszBuffer[256] = {0};
strcpy(pszBuffer, _T("setsdwperm.bat"));
strcat(pszBuffer, argv[1]);
ShellExecute(NULL, _T("open"), pszBuffer, NULL, NULL, SW_SHOWNORMAL);
}an even more easy way is this:
#include <stdio.h>
#include <stdlib.h>int _tmain(int argc, TCHAR* argv[]) {
ShellExecute(NULL, _T("open"), _T("setsdwperm.bat"), argv[1], NULL, SW_SHOWNORMAL);
}-- modified at 13:22 Monday 19th November, 2007
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]