PDA

View Full Version : Read a csv file from Internet



abghosh
20th February 2010, 07:38
Hi

I am a newbee in Qt4. I am trying to read a file which is on the web, e.g.:
from http://download.finance.yahoo.com/d/quotes.csv?s=DLF.NS&f=sl1d1t1c1ohgv&e=.csv.
without downloading it.

I am able to read a local csv file. But when I am trying to read this file, the file cannot be found.

Also I want to refresh the reading every 5 secs.

How can I do it?

Thanks in advance.

aamer4yu
20th February 2010, 07:54
How are you reading from the net ?

abghosh
20th February 2010, 07:56
Hi aamer4yu

That is the problem I am facing. I cannot read the file online. If I download it to local system, everything is fine.

squidge
20th February 2010, 14:16
WHAT are you using to access the file on the net?

Maybe have a look at QNetworkAccessManager/QNetworkRequest/QUrl ?

A typical usage might be manager->get(QNetworkRequest(QUrl("http://download.finance.yahoo.com/d/quotes.csv?s=DLF.NS&f=sl1d1t1c1ohgv&e=.csv")));

The call is asynchronous - you'll get your data in the appropriate slot.

codeslicer
20th February 2010, 17:04
You HAVE to download an item to read it. That's how all browsers do it. You can use QTemporaryFile to create a temporary file on the filesystem, and delete it when you're done.

~codeslicer