MCPcopy Create free account
hub / github.com/acl-dev/acl / get_html

Function get_html

lib_acl_cpp/samples/html/main.cpp:7–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "util.h"
6
7static void get_html(const char* file)
8{
9 acl_xml_tag_init();
10 acl_xml_tag_add("img");
11 acl_xml_tag_add("BR");
12 acl_xml_tag_add("HR");
13
14 acl::string buf;
15 if (acl::ifstream::load(file, &buf) == false)
16 {
17 printf("load %s error %s\r\n", file, acl::last_serror());
18 return;
19 }
20
21 struct timeval begin;
22 gettimeofday(&begin, NULL);
23
24 acl::xml xml(buf.c_str());
25 const acl::string& text = xml.getText();
26
27 struct timeval end;
28 gettimeofday(&end, NULL);
29
30 acl::string path(file);
31 path << ".txt";
32
33 acl::ofstream out;
34 if (out.open_write(path) == true)
35 out.write(text);
36
37 double spent = util::stamp_sub(&end, &begin);
38 printf("text:{%d}, spent: %.2f\r\n", (int) text.length(), spent);
39}
40
41int main(int argc, char* argv[])
42{

Callers 1

mainFunction · 0.70

Calls 9

acl_xml_tag_initFunction · 0.85
acl_xml_tag_addFunction · 0.85
last_serrorFunction · 0.50
gettimeofdayFunction · 0.50
stamp_subFunction · 0.50
c_strMethod · 0.45
open_writeMethod · 0.45
writeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…