![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2006
Location: Bathroom
Posts: 43
Rep Power: 0
![]() |
How can I open ie w c++
Hi, I have a question , How can I open ie w c++?
I'm trying to open the internet explorer w c++, I know how to do it, but, how can I open ie w the addres that I want(yahoo, cox, or whatever). |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
One way. Note that the extra quotes are required because of spaces in directory names.
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main ()
{
string prog = "\"E:\\Program Files\\Internet Explorer\\iexplore.exe\"";
string site = "http:\\\\www.yahoo.com";
string cmd = prog + " " + site;
system (cmd.c_str ());
return 0;
}
__________________
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 |
|
|
|
|
|
#3 |
|
Programmer
Join Date: May 2006
Location: Bathroom
Posts: 43
Rep Power: 0
![]() |
Thanks DaWei, you are the man. Do you know any book or web page to learn all this staff?
|
|
|
|
|
|
#4 |
|
Sexy Programmer
|
Thinking in C++
http://www.mindview.net/Books/TICPP/...ngInCPP2e.html
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
|
|
#5 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 6
![]() |
google "system C++" (not in quotes) and check MSDN or some such site to reference the other crap.
i added some comments, might be wrong. note he is escaping the '\' character so that's why there's extra backslashes. int main ()
{
//the absolute path to where internet explorer is on your computer
string prog = "\"E:\\Program Files\\Internet Explorer\\iexplore.exe\"";
//the site you want to start up with
string site = "http:\\\\www.yahoo.com";
//concatenating those variables for SYSTEM()
string cmd = prog + " " + site;
//(i believe) converting the previous concatenation into a c-string
//(array-based string) within the call to SYSTEM()
//this could be done in two steps to simplify...
//first convert to c-string, then make the call with the new variable
system (cmd.c_str ());
return 0;
}
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
#6 |
|
Programmer
Join Date: May 2006
Location: Bathroom
Posts: 43
Rep Power: 0
![]() |
Thanks
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Choosing a License for Open Source Project | smith.norton | Project Ideas | 23 | Oct 7th, 2006 4:27 AM |
| OnlineTextEditor.Com! | Sane | Show Off Your Open Source Projects | 43 | Jun 16th, 2006 9:55 AM |
| Help using this function | Eric the Red | Visual Basic | 10 | Feb 27th, 2006 11:26 AM |
| open a page and close it when it's done | diamondback | Visual Basic | 1 | Jan 28th, 2005 6:43 PM |