1 /* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include <simgrid/config.h>
7 #include <xbt/string.hpp>
8 #include <xbt/sysdep.h>
18 char string::NUL = '\0';
22 std::string string_vprintf(const char *fmt, va_list ap)
27 int size = std::vsnprintf(nullptr, 0, fmt, ap2);
29 xbt_assert(size >= 0, "string_vprintf error");
31 // Allocate the string and format:
35 xbt_assert(std::vsnprintf(&res[0], size + 1, fmt, ap) == size, "string_vprintf error");
39 std::string string_printf(const char *fmt, ...)
45 res = string_vprintf(fmt, ap);