xref: /phasta/phSolver/common/phString.cc (revision ee150812e03b04b642c5c2bd3124e8eb86e98922)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <cstring>
4 #include <string>
5 #include <sstream>
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 void phstr_appendInt(char* dest, int v) {
12   std::stringstream ss;
13   ss << dest << v;
14   std::string s = ss.str();
15   strcpy(dest, s.c_str());
16 }
17 
18 void phstr_appendDbl(char* dest, double v) {
19   std::stringstream ss;
20   ss << dest << v;
21   std::string s = ss.str();
22   strcpy(dest, s.c_str());
23 }
24 
25 void phstr_appendStr(char* dest, char* src) {
26   std::stringstream ss;
27   ss << dest << src;
28   std::string s = ss.str();
29   strcpy(dest, s.c_str());
30 }
31 
32 #ifdef __cplusplus
33 }
34 #endif
35