run other .exe files

I have been programming a game that involves a character creator as a separate .exe file that saves your character's information to a text file which then will load from the main game menu, but I want to be able to access the character creator from the ingame menu.

Could someone explain how to open .exe files with standard headers (or direct me to a header that would help me do that, that'd work too)?

Thanks.
closed account (zb0S216C)
Do not even contemplate the use of system( ). I forbid you!

For Windows, use CreateProcess( )[1].

References:
[1] http://msdn.microsoft.com/en-us/library/ms682425.aspx


Wazzak
Thanks for the reference, but I can't find where it tells what header file has it in it. The format looks like windows.h but I am not sure.

<edit>
I am sure it uses windows.h, and it also uses WinBase.h (is that standard with Code::Blocks?)

I also would rather it was simply working in command-line, because I am not progressed to where I can write windowed programs.
</edit>


Also, all of this program is command-line, so would it still work in that instance?

Thanks for reminding me that system( ) is eternally taboo.
Last edited on
Since it's a windows only option, I'd say yes, it's windows.h (I know CreateProcess is a windows.h function). There is a specific header in which CreateProcess resides, but without doing some digging of your own or research online, it's fairly difficult to find (Microsoft likes to keep their header files unknown for whatever reason and just bundle them all in windows.h).

On a side note, without using _WIN32_LEAN_AND_MEAN_, I heard that windows.h includes over 100 million, 100,000,000 (yes, that's 8 zeros), lines worth of code. Lean and mean has removed a lot of functions that are rarely used, but still only brought it down to 80+ million lines.
Thanks for the info on CreateProcess, but is there a function that allows me to do the same thing, only in command-line based programs?

Thanks again for the help.
Why can't you use CreateProcess in a console application? I read nothing about it requiring to be used in a Windows GUI program.
May ask why you can not just include the character creator in the program?

If its for organization reasons, then you can simply use functions.
how to make a function:
1
2
3
4
5
6
7
8
9
10
11
int /* this indicates what kind of result the function gives (void means it 
does not give a result). By result I mean as in int myVariable = myFunct() */

myFunction /* this is the name of the function */

(int arg1, int arg2) /*this contains arguments that it takes, leave it blank if 
you want () like this */

{
/* it is then followed by {} which you put your code between*/
}



1
2
int myFunction (int arg1, int arg2) {
}
Last edited on
I would include it in the program, but then I run into the problem of my variables already being defined when I go to load another character, I have already-defined variables, and my computer mixes and matches them, so I have one file that loads the game and plays the game and one that creates a new character.
If that is the reason you have it separate, your program is code poorly. You might need to learn more about C++ to understand a "proper" way to program.
Topic archived. No new replies allowed.