Hello, I read in a thread that you could use

system("start http://www.daniweb.com/");

to get the page Daniweb but I am wanting to write a program that the user can enter a website that he wishes to go to then the program takes the user there.

I got this so far but got errors, I know I've done it wrong - It was only a attempt.

// Code Shark

#include <iostream>

using namespace std;

int main() {
    char website[50];
    
    cout << "Enter a website : ";
    cin >> website;
    
    system("start", website);
    
    return 0;
    
    cin.get();
    cin.get();
}
Member Avatar for iamthwee
#include <iostream>
#include <string>

using namespace std;

int main()
{
   string website;

   cout << "Enter a website : ";
   cin >> website; 
   string a = "start ";
   string b = a + website;

   system ( b.c_str() ); 

   cin.get();
   cin.get();
   return 0;
}

sample input:

Enter a website : www.google.com

system ( b.c_str() );

What is c_str() doing?

>What is c_str() doing?
Why don't you read a C++ reference and find out?

Because he obviously knows what it is already

>Because he obviously knows what it is already
Your logic (or lack thereof) has stumped me. Can you explain what you mean and why you don't seem interested in doing as I suggested?

Why would I go into a C++ reference and go looking for the command when someone like you could clearly help me quicker

commented: Have you tried googling "c_str" and clicking on the first link ?? Im sure thats a heck of a lot faster less lazy than waiting for a reply.. +0
Member Avatar for iamthwee

>Why would I go into a C++ reference and go looking for the command when someone like you could clearly help me quicker

Gotta give him credit for that! Bless.

>Why would I go into a C++ reference and go looking for the
>command when someone like you could clearly help me quicker
Because I'll call you a lazy retard and refuse to help you for the rest of eternity. And I'll encourage everyone else to do the same thing because you're clearly not interested in learning, which is what Daniweb is about. If you don't respect us, we won't respect you.

you're clearly not interested in learning

LOL are you kidding me? I come to this forum and post a question ASKING what a code does and you throw that shit at me? You may know C++ but you are one huge dumbass. I encourage everyone to ignore fools like this.

If you don't respect us, we won't respect you.

Please quote me where I showed disrespect to anyone... (Other than just now when you proved to me that you are 12 years old)

commented: That's just too damn lazy dude X_X +0

Sorry slick, you came here asking for us to take time out of our lives to hand you answers on a silver platter because you're too lazy to search google for 5 whole seconds. That's made painfully clear with the following incredibly arrogant statement:

Why would I go into a C++ reference and go looking for the command when someone like you could clearly help me quicker

We're not your personal slaves, and after this display of the very attitude that we abhor the most, I recommend you leave Daniweb or start a new account because you're not likely to get any help in the future.

commented: Succinct and to the point as ever. +18

Why would I go into a C++ reference and go looking for the command when someone like you could clearly help me quicker

Because, give you bread and you may eat for one day, but teach you how to grow food and you will eat forever. Yes, Narue, or anyone else here, could easily just give you the answer and the next time you have another question you will have no clue how to get the answer so you will be right back here asking again. But if you learn how to look up the answers to your questions you will be able to answer your question yourself, saving you lots of time and effort. Its to your own benefit that you learn how to look up the answers to your questions, and ask us only when you can't find the answers somewhere else.

commented: nicely said :) +2
commented: Mmmm - fish +18

I am very capable of learning on my own. I have books and I study the language. My questions was on a very small piece of code which I assumed wouldn't be nearly as easy to find as a conventional command such as cout.

I won't make the mistake of thinking this forum was for C++ support again...

What is c_str() doing?

>What is c_str() doing?
Why don't you read a C++ reference and find out?

Why would I go into a C++ reference and go looking for the command when someone like you could clearly help me quicker

I am very capable of learning on my own. I have books and I study the language. My questions was on a very small piece of code which I assumed wouldn't be nearly as easy to find as a conventional command such as cout.

I won't make the mistake of thinking this forum was for C++ support again...

If you already have a c++ book then why didn't you just look up your question in your book? I'm certain there is a description of std::string class in that book. If there isn't, they you need a different book.

I ended up finding it on my own, but as I have stated on this thread, talking to someone who already knows what the command does just saves time...

In the sort run yes you are right that it would save time. But it hurts you in the long run -- now that you have found the answer on your own I'll bet you will know where to look next time. And, if you are like me, during your research you read lots of stuff that will be useful to you in the future.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.