⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chunk.c

📁 www工具包
💻 C
字号:
#include "WWWLib.h"#include "WWWHTTP.h"#include "WWWInit.h"PRIVATE int tracer (const char * fmt, va_list pArgs){    return (vfprintf(stderr, fmt, pArgs));}int main (int argc, char ** argv){    HTRequest * request = HTRequest_new();    HTChunk * chunk = NULL;    char * url = argc==2 ? argv[1] : NULL;    /* Initialize libwww core */    HTProfile_newPreemptiveClient("TestApp", "1.0");    /* Gotta set up our own traces */    HTTrace_setCallback(tracer);    /* Turn on TRACE so we can see what is going on */#if 0    HTSetTraceMessageMask("sop");#endif    /* We want raw output including headers */    HTRequest_setOutputFormat(request, WWW_RAW);    /* Close connection immediately */    HTRequest_addConnection(request, "close", "");    if (url) {	char * cwd = HTGetCurrentDirectoryURL();	char * absolute_url = HTParse(url, cwd, PARSE_ALL);	chunk = HTLoadToChunk(absolute_url, request);	HT_FREE(absolute_url);	HT_FREE(cwd);	/* If chunk != NULL then we have the data */	if (chunk) {	    char * string = HTChunk_toCString(chunk);	    printf("%s", string ? string : "no text");	    HT_FREE(string);	}    } else {	printf("Type the URL you want to accces on the command line\n");    }    /* Clean up the request */    HTRequest_delete(request);    /* Terminate the Library */    HTProfile_delete();    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -