Skip to content

Instantly share code, notes, and snippets.

@ilpropheta
Created January 2, 2017 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilpropheta/9589de931aeb9f9652b7be694aa22c8c to your computer and use it in GitHub Desktop.
Save ilpropheta/9589de931aeb9f9652b7be694aa22c8c to your computer and use it in GitHub Desktop.
char arr[5] {};
auto value1 = 10, value2 = 20;
auto ptrStart = arr; auto ptrEnd = arr + 5;
auto res = to_chars(ptrStart, ptrEnd, value1);
if (!res.overflow) // fitted the buffer?
res = to_chars(res.ptr, ptrEnd, value2);
// [‘1’, ‘0’, ‘2’, ‘0’, \0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment