Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. void print_some_info(int severity, const char* message, va_list argp)
  2. {
  3. UNSCOPED_INFO(message);
  4.  
  5. std::string value;
  6. value.resize(20);
  7. REQUIRE(value.size() == 20);
  8.  
  9. UNSCOPED_INFO("testing size of formated string");
  10. size_t size = vsnprintf(const_cast<char*>(value.c_str()), 0, message, argp);
  11. value.resize(size + 1);
  12. REQUIRE(value.size() == size + 1);
  13.  
  14. UNSCOPED_INFO("create copy of formate string");
  15. UNSCOPED_INFO("size of string is" << value.size());
  16. size = vsnprintf(const_cast<char*>(value.c_str()), value.size(), message, argp);
  17. UNSCOPED_INFO("size of string is" << size);
  18. REQUIRE(value.size() == size + 1);
  19.  
  20. //UNSCOPED_INFO("set null terminator");
  21. //value.c_str()[size] = 0;
  22.  
  23. UNSCOPED_INFO(value.c_str());
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement