Thread: Read in an online text file

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    18

    Read in an online text file

    Hello,

    I was wondering if there was any way that I could read in a file that is stored online. For example, if the file name was golf.txt, and it is on www.example.com/golf.txt. Is there any way I could read that in, and if so, how??

    Thanks!!!

  2. #2
    Registered User
    Join Date
    Nov 2008
    Location
    INDIA
    Posts
    64
    If you are working in linux machine you can get the online file using the command wget.

    It will store in a particular file in the current directory .From that you can read the contents .

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    18
    Thanks for the help, but unfortunately I'm using Windows. Any other way??

  4. #4
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    There is a version of wget for Windows. If not you just have to open a connection to that and print out the contents.

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    36
    Otherwise,you can use Get-Content command to get the file content from online.

  6. #6
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    Should be able to send an HTTP request to that URL and the contents will be returned to you. I try and stay away from C when doing any real web work, but I think you could use a socket and send a simple HTTP request and be good to go.

  7. #7
    Registered User
    Join Date
    Jan 2010
    Posts
    18
    Could anyone give me an example?? I am pretty new to C and don't know how I would implement your solutions

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help is needed to read text from a file
    By yuzhangoscar in forum C Programming
    Replies: 12
    Last Post: 09-12-2008, 12:10 AM
  2. [HELP] Read text file in vc++ 2005
    By sonnb in forum C++ Programming
    Replies: 1
    Last Post: 05-12-2007, 10:01 AM
  3. How to read chars from a text file and use them in TChart
    By Bachatero in forum C++ Programming
    Replies: 1
    Last Post: 08-29-2006, 04:03 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM