Code für die Regelungsplatine
Dependencies: mbed-dev
strdup.cpp@0:e06857c6841e, 2017-05-10 (annotated)
- Committer:
- David_90210
- Date:
- Wed May 10 09:32:51 2017 +0000
- Revision:
- 0:e06857c6841e
Code f?r die Regelungsplatine
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
David_90210 | 0:e06857c6841e | 1 | #include "strdup.h" |
David_90210 | 0:e06857c6841e | 2 | #include <stdlib.h> |
David_90210 | 0:e06857c6841e | 3 | #include <string.h> |
David_90210 | 0:e06857c6841e | 4 | |
David_90210 | 0:e06857c6841e | 5 | char *strdup(const char *s) |
David_90210 | 0:e06857c6841e | 6 | { |
David_90210 | 0:e06857c6841e | 7 | char* dup = (char*)malloc(strlen(s) ); |
David_90210 | 0:e06857c6841e | 8 | if(dup != NULL) |
David_90210 | 0:e06857c6841e | 9 | strcpy(dup, s); |
David_90210 | 0:e06857c6841e | 10 | return dup; |
David_90210 | 0:e06857c6841e | 11 | } |
David_90210 | 0:e06857c6841e | 12 | |
David_90210 | 0:e06857c6841e | 13 |