C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 12th, 2005, 12:47 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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 =Þ !!

Reply With Quote
  #2  
Old July 12th, 2005, 01:32 AM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
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.



Reply With Quote
  #3  
Old July 12th, 2005, 01:43 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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.

Reply With Quote
  #4  
Old July 12th, 2005, 02:05 AM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 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 )

Reply With Quote
  #5  
Old July 12th, 2005, 02:17 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
Smile TY again

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.

Reply With Quote
  #6  
Old July 12th, 2005, 02:05 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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

Reply With Quote
  #7  
Old July 12th, 2005, 03:13 PM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
happy to be of help

Reply With Quote
  #8  
Old July 12th, 2005, 04:30 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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 ;)

Reply With Quote
  #9  
Old July 13th, 2005, 01:52 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
[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?

Reply With Quote
  #10  
Old July 13th, 2005, 07:29 PM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 43 sec
Reputation Power: 4
Quote:
Originally Posted by Geo.Garnett
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?
Check it out here. Basically, it just preserves the text the exact way you enter it, so the whitespace (indenting) doesn't get stripped out. It makes it much easier for other people to follow

Reply With Quote
  #11  
Old July 13th, 2005, 08:33 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > NooB NeeD HeP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway