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
2010-09-24 10:33:09
..if and only if he's on Windows.
halfdan
2010-09-24 10:37:26
nope i am not interested in windows ...
sango
2010-09-24 10:39:44
@halfdan : indeed, Win Sucks ... (ok I can --->[] )
Elenaher
2010-09-24 10:40:23
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
2010-09-24 21:07:03