| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
NooB NeeD HeP
I am like the topic says, a noob, but I am trying to write a program in C++, a console app. and I got a question that I cant find in my book. Can I write a program in C++ that will open and play other programs that are not in that program. For example I have a game that I have several different versions(mods) of the same game inside the main folder. Could I make a number menu that will select the files and play them. Is this even possible?
There is a way to do it in MS-DOS but I dont want to confuse my self and try and learn something that I am not going to use later, being that I am studying C++ in all. Please help. A simple yes or no is fine, I just need to know if its possible and I dont mind working until I get it, but any additional informaion I wouldn't mind either =Þ !! |
|
#2
|
||||
|
||||
|
There are quite a few ways to run other programs.
For a Windows shell command, use "start program.exe". Do do it in C, there are many options. View this link for more detail.
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips. ![]() |
|
#3
|
||||
|
||||
|
Many Thanks
I have briefly read over the link you gave me. But to add to my question, Can you use these child programs even if the parent program isn't written in C++?
I'm going to try some of these examples to see if they work for me any ways. I appreciate your fast response. Thanks again. Ill post my results in a little while to let you know how it came out. |
|
#4
|
||||
|
||||
|
Yes. Any program can be run regardless of the partent program's language (assuming that the langauge allows you to run programs, that is
) |
|
#5
|
||||
|
||||
|
Alrighty then, I'm gonna get crackin on it in the morning. I appreciate you letting me pick yer brain a little. I'm just learning the language and there's only so many Oregon trail programs I can write before I throw up.
So I had to figure out a program that means something to me and would be use full in my life rather than just watching words on the screen and simple interactions with a user, you know. Thanks again and If you don't mind I'm gonna add you to my Buddie list thing. Just in case I need help in the future. ![]() |
|
#6
|
||||
|
||||
|
New Question??
Ok heres my delima now, I got this program working. I wrote it as a switch statement, with each statement, it renames the appropriate .vpp file. and it plays the right (mod) but once the file is renamed it doesnt change back to the orginal name. Is there a syntax for a temporary change of file name rather than just useing "rename"?
Last edited by Geo.Garnett : July 12th, 2005 at 03:43 PM. Reason: New |
|
#7
|
||||
|
||||
|
happy to be of help
![]() |
|
#8
|
||||
|
||||
|
Finished a working copy of what I am working on
Thanks B-Con;
I did it finally only took two days =Þ!! ok heres the code and I put the .exe in the game folder and it lets me choose the mod and changes the file back when Im finished. Theres probably better ways to write it Im sure but Im just a begginer Code:
#include <iostream>
#include <stdio.h>
#include <process.h>
using namespace std;
int main(void)
{
int choice = 0;
do//Menu loop//
{
cout<<" Red Faction Mod Menu \n"
<<" Please choose your mod \n"
<<" 1] Ranswer mod \n"
<<" 2] Converged mod \n"
<<" 3] Original ui \n";
cin>>choice;
}
while (choice < 0 ||choice > 4);//loop conditions//
{
switch (choice)//switches menu choice//
{
case 1:
cout<<" You chose Ranswer Mod ";
rename ("Ranswer Mod.vpp", "ui.vpp");//changes
//files to correct name//
break;
case 2:
cout<<"you chose Converged Mod ";
rename ("Converged Mod.vpp", "ui.vpp");
break;
case 3:
cout<<" You chose the Original game ";
rename ("Original_ui.vpp", "ui.vpp");
}
}
spawnl(P_WAIT, "RF.exe","RF.exe", "","","", NULL);
atexit;
if (choice == 1)
{
rename ("ui.vpp","Ranswer Mod.vpp");
//changes them back to correct//
}
else if (choice == 2)
{
rename ("ui.vpp","Converged Mod.vpp");
}
else
{
rename ("ui.vpp","Original_ui.vpp");
}
return 0;
}
Last edited by B-Con : July 12th, 2005 at 06:16 PM. Reason: don't forget your [code] tags ;) |
|
#9
|
||||
|
||||
|
[code]
B-con What do you mean by [code] tags? by that do you mean comments? Or do you mean that scroll box that you put my code in? Because I dont know how to do that just yet.
![]() Im assuming that you put a [ before your code and a ] after you've finished? |
|
#10
|
||||
|
||||
|
Quote:
![]() |
|
#11
|
||||
|
||||
|
Code:
Preciate that, makes sense now. :) Ill be sure to do that next time. It does make it easier to follow. he he just checkin it out ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > NooB NeeD HeP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|