简体   繁体   中英

Read csv file from website into c++

I'd like to read the contents of a .csv file from a website, into a c++ program. Specifically, it is financial data of the form from google finance.

http://www.google.com/finance/historical?cid=22144&startdate=Nov+1%2C+2011&enddate=Nov+14%2C+2011

(If you append "&output=csv" to the above link it will download the data as a csv file)

I know that I can use something like libcurl to download the file and then read it in from there, but I wanted to read it directly into the program without having to write it to a file first.

Can I get some suggestions on the best way to do this? I was thinking boost.asio but I have no experience with it (or network programming in general).

If you are trying to download it from a web resource you will need to implement at least some part of the HTTP protocol. libcurl will do this for you.

You don't need to save it as a file. This example will show you how to download and store it in a memory buffer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM