Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 22nd, 2006, 7:50 PM   #1
jobobshishkabob
Programmer
 
Join Date: Jan 2006
Location: Texas
Posts: 36
Rep Power: 0 jobobshishkabob is on a distinguished road
Quick n00by question...

Well if you've read my posts before, i am a noob...

just a quick question...

I want to cout<<"Press any key to Enter";
or cout<<"Press Enter/Return to Enter";

and the cin>> ent; should launch a file which is located at ./prgm/ddww.exe


how do i do that???

i need to know this because i'm having bad luck with batch files... thanks.
jobobshishkabob is offline   Reply With Quote
Old Jan 22nd, 2006, 7:56 PM   #2
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
You're having trouble double clicking a batch file? Opening a batch this way has the same effect as clicking on it. Well here it is anyways:

#include <iostream>
using namespace std;

int main()
{
cout << "Press enter.";
cin.get();
system("start c:/myprogram.exe"); //A bat file has .bat extension by the way, not an exe.
return 0;
}
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Jan 22nd, 2006, 7:58 PM   #3
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
you can use system function call.
system("./prgm/ddww.exe");
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Jan 22nd, 2006, 8:28 PM   #4
jobobshishkabob
Programmer
 
Join Date: Jan 2006
Location: Texas
Posts: 36
Rep Power: 0 jobobshishkabob is on a distinguished road
thank you both.

does any one know how to make both files open in the same window?
jobobshishkabob is offline   Reply With Quote
Old Jan 22nd, 2006, 8:34 PM   #5
jobobshishkabob
Programmer
 
Join Date: Jan 2006
Location: Texas
Posts: 36
Rep Power: 0 jobobshishkabob is on a distinguished road
what?????

this isnt working. its bring me the same results as the batch files...

all my pages are different .exe's

and if i open the "ddww.exe" through something else, like a .bat file or this exe, its closing at the time i open a page...

what ever im just going to mix the 2 pages. thanks for the help.
jobobshishkabob is offline   Reply With Quote
Old Jan 23rd, 2006, 1:12 AM   #6
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 259
Rep Power: 3 Cache is on a distinguished road
For a batch file, use the 'Call' command: Call some.exe

Although I'm wondering what you mean by "pages". Whatever it is you're after doing, there is probably a better way to achieve it than through calling multiple executables with a batch file.
Cache is offline   Reply With Quote
Old Jan 23rd, 2006, 11:03 AM   #7
teencoder
Hobbyist Programmer
 
teencoder's Avatar
 
Join Date: Jul 2005
Posts: 158
Rep Power: 0 teencoder is an unknown quantity at this point
Try running your program through the console it shouldn't disappear that way.
__________________
Geeks may not be cool now but in the long run they prosper.
teencoder is offline   Reply With Quote
Old Jan 23rd, 2006, 11:53 AM   #8
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 3 Polyphemus_ is on a distinguished road
Put system("pause"); in your code, just before it returns.
Polyphemus_ is offline   Reply With Quote
Old Jan 23rd, 2006, 6:12 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Better than a system call (non portable), put a statement that's part of the standard library that requires input from the user. Discard the input and move on to termination.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jan 24th, 2006, 12:25 PM   #10
weeb0
Newbie
 
Join Date: Jan 2006
Posts: 17
Rep Power: 0 weeb0 is on a distinguished road
add a pause at the end of the batch file.
weeb0 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:09 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC