1 /* Copyright (c) 2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include <simgrid_config.h>
12 #include <xbt/string.hpp>
13 #include <xbt/sysdep.h>
20 const char string::NUL = '\0';
24 std::string string_vprintf(const char *fmt, va_list ap)
29 int size = std::vsnprintf(nullptr, 0, fmt, ap2);
32 xbt_die("string_vprintf error");
34 // Allocate the string and format:
37 if (size != 0 && std::vsnprintf(&res[0], size + 1, fmt, ap) != size)
38 xbt_die("string_vprintf error");
42 std::string string_printf(const char *fmt, ...)
48 res = string_vprintf(fmt, ap);