We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd54a0f commit 80a7a52Copy full SHA for 80a7a52
2 files changed
SystemLib/Std/std.c
@@ -22,4 +22,21 @@ int strlen(const char *str) {
22
int len = 0;
23
while (*str++) len++;
24
return len;
25
+}
26
+
27
+void strcpy(char* dst, const char *src) {
28
+ while (*src) {
29
+ *dst++ = *src++;
30
+ }
31
+ *dst = 0;
32
33
34
+void strncpy(char* dst, const char *src, unsigned int n) {
35
+ unsigned int i;
36
+ for (i = 0; i < n && src[i]; i++) {
37
+ dst[i] = src[i];
38
39
+ if (i < n) {
40
+ dst[i] = 0;
41
42
}
SystemLib/Std/std.h
@@ -6,5 +6,7 @@
6
int strcmp(const char *s1, const char *s2);
7
int strncmp(const char *s1, const char *s2, unsigned int n);
8
int strlen(const char *str);
9
+void strcpy(char *dst, const char *src);
10
+void strncpy(char *dst, const char *src, unsigned int n);
11
12
#endif
0 commit comments