OSDN Git Service

VER0.1.0
[lib1stclass/main.git] / shmf.c
diff --git a/shmf.c b/shmf.c
index 265e7d8..530aa1e 100755 (executable)
--- a/shmf.c
+++ b/shmf.c
@@ -1,6 +1,15 @@
 #include <string.h>
 
-char *shmf(const char *file, char *shmfile){
+#ifdef __cplusplus
+#include "1stclass.hpp"
+string firstclass::shmf(const string in_file){
+  const char *file=in_file.c_str();
+  char shm_file[1024]="";
+#else
+#include "lib1stclass.h"
+int shmf(const char *file, char *shm_file){
+#endif
+
   char tmp_file[1024]="";
   int i;
   safe_strcat(tmp_file, file);
@@ -12,7 +21,14 @@ char *shmf(const char *file, char *shmfile){
       break;
     }
   }
-  safe_strcat(shmfile, "/dev/shm/");
-  safe_strcat(shmfile, tmp_file);
-  return tmp_file;
+
+  safe_strcat(shm_file, "/dev/shm/");
+  safe_strcat(shm_file, tmp_file);
+
+#ifdef __cplusplus
+  string result(shm_file);
+  return result;
+#else
+  return 0;
+#endif
 }