MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / str2buf

Function str2buf

src/CoolPropLib.cpp:25–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include <mutex>
24
25void str2buf(const std::string& str, char* buf, int n) {
26 if (str.size() < static_cast<unsigned int>(n)) {
27 strncpy(buf, str.c_str(), n - 1);
28 buf[n - 1] = '\0';
29 } else {
30 throw CoolProp::ValueError("Buffer is too small; must be at least " + std::to_string(str.size()) + " characters in size");
31 }
32}
33void HandleException(long* errcode, char* message_buffer, const long buffer_length) {
34 try {
35 throw; // Rethrow the error, and here we handle the error

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected