Program in program

Does anyone know how to make program which creates other program. E.g. I launch program and it creates hello program as other executable
Well, that's called a compiler, I think...

What are you trying to do?
Yea...
I'm talking about something like writing to file. Instead of text i want to write compiled and linked code
Yeah...just write the code into the compiler, then run the compiler and it should link/stuff for you.
How to explain...step by step...
1. I write code
2 I compile it
3 I run it
4 program output:
executable created. Click Y to run it.
4. Created program output 'hello'
so i need to create program function

void theProgram(){
cout <<"hello";
}

this code will be compiled.
QUESTION:
how to insert compiled code into another file or executable?
Hrmm, well I guess you could write a program that opens a file, writes the code into it, names it a .cpp, and then runs the compiler to compile it for you, but I am not sure if that is what you want.

If you want a program to just make the "compiled" code, well then you are going to have to have it write assembly most likely, but I have no idea how you would go about doing that.
Topic archived. No new replies allowed.