#ifndef LIPSUM_BUILD_STATIC
# define LIPSUM_IMPLEMENTATION
#endif
#include <zlib.h>
int main()
{
std::string text = gen.
fmt_text(100000);
uLong textLen = text.size();
uLong compLen = compressBound(textLen);
std::vector<unsigned char> comp(compLen);
if (compress(comp.data(),
&compLen,
reinterpret_cast<const Bytef*>(text.data()),
textLen) != Z_OK)
{
return -1;
}
while (comp.back() == 0)
{
comp.pop_back();
}
std::cout << "Original size: " << text.size() << '\n';
std::cout << "Compressed size: " << comp.size() << '\n';
return 0;
}
Main class of lipsum-cpp.
Definition generator.hpp:92
std::string fmt_text(int numElements=15, bool useHtml=false)
Generate a Markdown or HTML document.
Definition generatorformats.inl:53
Main header of lipsum-cpp.