From 5f29843ab2ccb90177b6d815720717daa63cf6d3 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sun, 16 Nov 2025 12:01:34 +0900 Subject: [PATCH] string --- include/MDE/File.h | 2 +- include/MDE/Foundation.h | 1 + include/MDE/String.h | 16 ++++++++++++++++ src/string.c | 12 ++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 include/MDE/String.h create mode 100644 src/string.c diff --git a/include/MDE/File.h b/include/MDE/File.h index 046205d..bf663ac 100644 --- a/include/MDE/File.h +++ b/include/MDE/File.h @@ -1,5 +1,5 @@ #ifndef __MDE_FILE_H__ -#define __MDE_FIlE_H__ +#define __MDE_FILE_H__ #include diff --git a/include/MDE/Foundation.h b/include/MDE/Foundation.h index 1d1badc..5a50315 100644 --- a/include/MDE/Foundation.h +++ b/include/MDE/Foundation.h @@ -4,5 +4,6 @@ #include #include +#include #endif diff --git a/include/MDE/String.h b/include/MDE/String.h new file mode 100644 index 0000000..83bb78d --- /dev/null +++ b/include/MDE/String.h @@ -0,0 +1,16 @@ +#ifndef __MDE_STRING_H__ +#define __MDE_STRING_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +char* MDEStringDuplicate(const char* src); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/string.c b/src/string.c new file mode 100644 index 0000000..0a603a7 --- /dev/null +++ b/src/string.c @@ -0,0 +1,12 @@ +#include + +#include +#include + +char* MDEStringDuplicate(const char* src){ + char* s = malloc(strlen(src) + 1); + + strcpy(s, src); + + return s; +}