Creating Executable By Code?

TinyClone's Avatar, Join Date: Apr 2006
Go4Expert Member
How do you make an executable by a program? I want to have an option in my program to create an executable... how? thx in advance
sharmila's Avatar, Join Date: Mar 2006
Contributor
I don't know whether it helps you or not.
There is a function called system() which is used to issue a shell command.
int system(const char *string);
string is the command.
int system("cc sample.c -o sample");
Then you will get an executable sample.
coderzone's Avatar, Join Date: Jul 2004
Team Leader
Quote:
Originally Posted by TinyClone
How do you make an executable by a program? I want to have an option in my program to create an executable... how? thx in advance
What compiler you are using to program the code.
TinyClone's Avatar, Join Date: Apr 2006
Go4Expert Member
C++ / Visual Studio
coderzone's Avatar, Join Date: Jul 2004
Team Leader
Compiling the code will be creating the exe in the debug/Release folder in the workspace folder.
TinyClone's Avatar, Join Date: Apr 2006
Go4Expert Member
This is what I mean:

You have a programm, let's say it makes maze games. A user can set different settings, and then he clicks File -> Create executable. So I want to make a programm that wil make programms .
coderzone's Avatar, Join Date: Jul 2004
Team Leader
Thats a very complicated situations. You need to be having compiler to generate the executables but I guess your problem can be solved by a couple of ways.

1. Allow them saving a file of your custom extension say mz and when user double clicks it it opens using your application.
2. You save a compiled executable as a resource in the project of your VC and when user saves the data extract the binary resource to the harddisk and assign the settings accordingly into some predefined resources.
TinyClone's Avatar, Join Date: Apr 2006
Go4Expert Member
well i was thinking about have a prefab executable that opens a file of custom exenstension, but i was wondering is it was possible to create my own custom made executable. (I seen it in some programs)
coderzone's Avatar, Join Date: Jul 2004
Team Leader
Can you give us an example of such a program.
TinyClone's Avatar, Join Date: Apr 2006
Go4Expert Member
www.gamemaker.nl