_R2D2 Posted September 29, 2004 Share Posted September 29, 2004 I am writing a short app to download updatd shoutcast playlists for my favourite stations. I have heard of netstream in c++.....but it is nowhere in my c++ book. Where can I find tutorials for c++ internet programming. Only basic, the only thing I need is to download a file.... Link to comment Share on other sites More sharing options...
0 electic102 Posted September 29, 2004 Share Posted September 29, 2004 Do you want it to be a console program? In any case, use a async socket and you will be fine. See WIN32 API for more info. http://msdn.microsoft.com Link to comment Share on other sites More sharing options...
0 Andareed Posted September 30, 2004 Share Posted September 30, 2004 Check out wininet.dll: HINTERNET hInternet = InternetOpen("", INTERNET_OPEN_TYPE_DIRECT, NULL, 0); HINTERNET hFile = InternetOpenUrl(hInternet, "http://blah.com/file.txt", NULL, 0, 0, NULL); BOOL bStatus = InternetReadFile(hFile, pszBuffer, dwBufferSize, &dwBytesRead); Link to comment Share on other sites More sharing options...
0 _R2D2 Posted September 30, 2004 Author Share Posted September 30, 2004 Yes...it should be a console app. Andreed: thanks, I will play around with it when I come home. Could you explain the code a little bit? Is the file loaded to a variable? Link to comment Share on other sites More sharing options...
0 Andareed Posted September 30, 2004 Share Posted September 30, 2004 InternetOpen connects to the internet and returns a "handle to the internet". InternetOpenUrl connects to the url and returns a handle to the internet file. InternetReadFile actually reads the internet file's contents. It stores the contents to pszBuffer. dwBufferSize contains the size of pszBuffer. dwBytesRead contains the number of bytes actually read. Link to comment Share on other sites More sharing options...
0 _R2D2 Posted October 1, 2004 Author Share Posted October 1, 2004 Which header files do I need? windows.h? Link to comment Share on other sites More sharing options...
0 Andareed Posted October 1, 2004 Share Posted October 1, 2004 windows.h and wininet.h. You'll need to link to wininet.lib as well. Link to comment Share on other sites More sharing options...
Question
_R2D2
I am writing a short app to download updatd shoutcast playlists for my favourite stations.
I have heard of netstream in c++.....but it is nowhere in my c++ book.
Where can I find tutorials for c++ internet programming. Only basic, the only thing I need is to download a file....
Link to comment
Share on other sites
6 answers to this question
Recommended Posts