1 /* Copyright (c) 2015-2019. 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);
30 xbt_die("string_vprintf error");
32 // Allocate the string and format:
35 if (size != 0 && std::vsnprintf(&res[0], size + 1, fmt, ap) != size)
36 xbt_die("string_vprintf error");
40 std::string string_printf(const char *fmt, ...)
46 res = string_vprintf(fmt, ap);