First draft of AGG plot modules. The old one based on GNU libplot is removed. - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/string_printf.cpp
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2009年11月18日 19:31:25 +0000
committerFrancesco Abbate <francesco.bbt@gmail.com>2009年11月18日 19:31:25 +0000
commitb2d5b7d64100164e40e3141094736f2ac010a69f (patch)
tree41ac9a78eea0c8c677b7dff6e6a46f5f901fae19 /agg-plot/string_printf.cpp
parente8a10279d92ab7a66402bae02a8fc423a6162fd5 (diff)
downloadgsl-shell-b2d5b7d64100164e40e3141094736f2ac010a69f.tar.gz
First draft of AGG plot modules. The old one based on GNU libplot is removed.
Diffstat (limited to 'agg-plot/string_printf.cpp')
-rw-r--r--agg-plot/string_printf.cpp 24
1 files changed, 24 insertions, 0 deletions
diff --git a/agg-plot/string_printf.cpp b/agg-plot/string_printf.cpp
new file mode 100644
index 00000000..884550bd
--- /dev/null
+++ b/agg-plot/string_printf.cpp
@@ -0,0 +1,24 @@
+
+#include <string>
+#include <stdarg.h>
+
+void
+string_printf (std::string &s, const char *fmt, ...)
+{
+ va_list ap;
+ char *buf;
+ int n;
+
+ va_start (ap, fmt);
+
+ n = vasprintf (&buf, fmt, ap);
+ if (n <= 0)
+ {
+ s = "";
+ return;
+ }
+
+ s = (const char *) buf;
+ free (buf);
+ va_end (ap);
+}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月26日 10:15:56 +0000

AltStyle によって変換されたページ (->オリジナル) /