Thread: Reading Files with fstream

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    112

    Reading Files with fstream

    Is it possible to read a file off the internet using fstream? For example can I do something like:

    #include <iostream.h>
    #include <fstream.h>

    int main()
    {
    char buffer[50];
    ifstream File("www.internetSite.com/file.txt");
    File.getline(buffer,50);
    cout << buffer;
    File.close()
    return 0;
    }

    Can someone please tell me how I could do something like this using fstream or a different method?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    It'd be nice if it were that easy. To be honest, I've never tried but I imagine that something like this would require the use of sockets. Do a google search for beej, that will give you a nice shove into the socket programming world.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  2. Issues reading text files
    By ozzy34 in forum C++ Programming
    Replies: 5
    Last Post: 06-01-2004, 08:15 AM
  3. Reading files in a directory
    By roktsyntst in forum Windows Programming
    Replies: 5
    Last Post: 02-07-2003, 10:04 AM
  4. problem reading files in C
    By angelfly in forum C Programming
    Replies: 9
    Last Post: 10-10-2001, 11:58 AM
  5. Need Advice in reading files
    By jon in forum C Programming
    Replies: 4
    Last Post: 10-07-2001, 07:27 AM