寫教學的最大目的是教會未來的自己

C/C++ 簡易檔案下載

參考資料 http://www.eyny.com/thread-6095660-1-1.html

http://codepad.org/hJ0fFsA0

還有一個方法是 去下載使用 wget 透過 system() 的方式呼叫下載

 


#include <cstdio>
#include <tchar.h>
#include <urlmon.h>
#include <iostream>
#pragma comment(lib, "urlmon.lib")
#pragma comment(lib, "ws2_32.lib")
using namespace std;

int main()
{	
	cout << "downloading picture...";
	HRESULT hr = URLDownloadToFile ( NULL, _T("http://l.yimg.com/o/xp/cna/20110321/10/1042421579.jpg"), _T("00001.jpg"), 0, NULL );
	cout << "Done!" << endl;
	return 0;

}

Post to Twitter Post to Plurk Post to Facebook Send Gmail

2 Responses to C/C++ 簡易檔案下載

發表迴響

Copyright © 2024. All Rights Reserved.

歡迎光臨
初音