A small library that's provide helpers for programmers
Diff: MyLibc.cpp
- Revision:
- 1:ee7a5f05513d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MyLibc.cpp Tue Feb 17 11:55:34 2015 +0000 @@ -0,0 +1,15 @@ + +#include "MyLibc.h" + +#include "mbed.h" + +char *strdup(const char *str) { + uint32_t len; + char *copy; + + len = strlen(str) + 1; + if (!(copy = (char*)malloc(len))) + return 0; + strncpy(copy,str,len); + return copy; +} \ No newline at end of file