tags:

views:

59

answers:

2

hello, i need to read an remote file using c++ if it is text or html we can get it though curl and for .mp3 or any other file how can i get the file....

A: 

You can write your own HTTP socket using WinSock.

If you're not using Windows then you can use Berkeley Sockets

WinSock is actually very close to Berkeley sockets in implementation. See here -> http://msdn.microsoft.com/en-us/library/ms740096%28VS.85%29.aspx

Mark Ingram
..if and only if he's on Windows.
halfdan
nope i am not interested in windows ...
sango
@halfdan : indeed, Win Sucks ... (ok I can --->[] )
Elenaher
A: 

You can use popen(...) for stuff like this in C/C++

FILE* remote = popen("curl 'http://host/path/to/your/file.ext'", "r");
char buf[1024];
fread(buf, 1024, 1, remote);

The man page for popen should get you started.

xscott