Code directly.
/* Valid Website: Invalid Website: http://tyq3.huaxiazi.com/mp3/4101/qhggs00802.mp3 */# include "wininet. H "# pragma comment (Lib," wininet. lib ") # define condition failed: checkurlfileexist (tchar * ptcfileaddress) {hinternet = NULL; tchar tcret [buffer_size + 1]; DWORD dwbuflength = buffer_size; DWORD dwindex = 0; zeromemory (tcret, sizeof (tchar) * (Buffer_size + 1); ghinstance = internetopen (L "ineturl:/1.0", internet_open_type_preconfig, null, null, 0/* internet_flag_async */); if (null = ghinstance) {retailmsg (1, (L "Call internetopen failed: % d \ r \ n", getlasterror (); Return false ;} hinternet = internetopenurl (ghinstance, ptcfileaddress, null, 0, internet_flag_reload, 0); If (null = hinternet) {retailmsg (1, (L "Call internetopenurl failed: % d \ r \ n ", getlaste Rror (); Return false;} If (httpqueryinfo (hinternet, http_query_status_code, tcret, & dwbuflength, & dwindex) {If (0! = _ Wcsicmp (tcret, l "200") & 0! = _ Wcsicmp (tcret, l "302") {retailmsg (1, (L "invalid WWW address: % s! \ R \ n ", tcret); Return false ;}} else {retailmsg (1, (L" Call httpqueryinfo failed: % d \ r \ n ", getlasterror (); Return false;} retailmsg (1, (L "valid WWW address: % s! \ R \ n ", tcret); Return true ;}