title: Reading text from a website in C++
body: <p>I am currently coding a chat application-like-thing, and it writes and reads from a .txt file on DropBox in my 'public' folder. I was wondering how exactly I could achieve this. </p>
  
  <p>My code so far is:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;Windows.h&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  
  int main () {
      string output;
      string outputty;
      string Chat;
      string option;
  
      string line;
      ofstream players;
      ifstream chat;
      fstream chatw;
  
      cout &lt;&lt; "(1) - Enter\n";
      cin &gt;&gt; option;
      if (option == "1") {
          players.open ("C:/Users/Pebsie/Dropbox/Public/data.txt");
          string name;
          cout &lt;&lt; "\nWhat is your name?\n";
          cin &gt;&gt; name; 
          players &lt;&lt; name;
          players.close();
          cout &lt;&lt; "Entering..";
          chatw.open ("C:/Users/Pebsie/Dropbox/Public/chat.txt", fstream::out | fstream::app | fstream::ate);
          chatw &lt;&lt; "***" &lt;&lt; name &lt;&lt; " Entered the game*** " &lt;&lt; endl;
          chatw.close();
          while (1) {
              system("cls");
              ifstream myfile ("C:/Users/Pebsie/Dropbox/Public/chat.txt");
              if (myfile.is_open()) {
                  while ( myfile.good() )
                  {
                      getline (myfile,line);
                      cout &lt;&lt; line &lt;&lt; endl;
                  }
                  myfile.close();
              }
  
              cin &gt;&gt; option;
              if (option == "/refresh") {
                   //DO NOTHING
              }
              else if (option == "/clearchat") {
                  chatw.open ("C:/Users/Pebsie/Dropbox/Public/chat.txt", fstream::out);
                  chatw &lt;&lt; name &lt;&lt; " cleared the chat." &lt;&lt; endl;
                  chatw.close();
              }
              else {
                  chatw.open ("C:/Users/Pebsie/Dropbox/Public/chat.txt", fstream::out | fstream::app | fstream::ate);
                  chatw &lt;&lt; name &lt;&lt; ": " &lt;&lt; option &lt;&lt; endl;
                  chatw.close();
              }
          }
          system("pause"); 
          chatw.open ("C:/Users/Pebsie/Dropbox/Public/chat.txt", fstream::out | fstream::app | fstream::ate);
          chatw &lt;&lt; "***" &lt;&lt; name &lt;&lt; " Left the game..*** " &lt;&lt; endl;
          chatw.close();
          return 0;
      } 
  }
  </code></pre>
  
  <p>When I code it, I test it locally, but still write to it so that the users can see what I'm updating to it. </p>
  
  <p>So, any help would be greatly appreciated, thanks!</p>
  
  <p>EDIT- My question, is how I would actually be able to write to and read from the dropbox file. It's public URL is <a href="http://dl.dropbox.com/u/17570838/chat.txt" rel="nofollow">http://dl.dropbox.com/u/17570838/chat.txt</a>
  / how I could load the file from the online URL.</p>
  
  <p>P.S It's just going to be used as a chat app for a test, it obviously isn't very good as it doesn't auto update.</p>