Reading Files with fstream

This is a discussion on Reading Files with fstream within the C++ Programming forums, part of the General Programming Boards category; Is it possible to read a file off the internet using fstream? For example can I do something like: #include ...

  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,796
    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, 09: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, 12:58 PM
  5. Need Advice in reading files
    By jon in forum C Programming
    Replies: 4
    Last Post: 10-07-2001, 08:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21