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

Function test_mmap_read

lib_acl_cpp/samples/string/string5/main.cpp:37–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37static void test_mmap_read(size_t off)
38{
39 const char* filename = "local.map";
40 acl::fstream fp;
41 if (!fp.open(filename, O_RDWR | O_CREAT, 0600))
42 {
43 printf("open %s error %s\r\n", filename, acl::last_serror());
44 return;
45 }
46
47 size_t max_len = 1024 * 1024 * 500, init_len = 0;
48 acl::string buf(fp.file_handle(), max_len, init_len, off);
49
50 char tmp[256];
51 memcpy(tmp, buf.c_str(), sizeof(tmp) - 1);
52 tmp[sizeof(tmp) - 1] = 0;
53 printf("[%s]\r\n", tmp);
54}
55
56static void test_mem(int max)
57{

Callers 1

mainFunction · 0.85

Calls 5

memcpyFunction · 0.85
file_handleMethod · 0.80
last_serrorFunction · 0.50
openMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…