pull/29/head
E. Almqvist 3 years ago
parent d7b97a830b
commit b671216aa9
  1. 11
      lib/str.c

@ -1,10 +1,11 @@
#include "str.h" #include "str.h"
unsigned int strlen(char* str) { unsigned int strlen(char* str) {
char* c; unsigned int len = 0;
for( c = str; *c != '\0'; c++ ) // search for end-of-string for( char* c = str; *c != '\0'; c++ ) // search for end-of-string
len++;
return (unsigned int)(c - str); // get size by delta-address
return len;
} }
char* strcat(char* buf, char* str) { char* strcat(char* buf, char* str) {
@ -20,5 +21,7 @@ char* strcat(char* buf, char* str) {
cc++; cc++;
} }
*(buf + bufferlen + cc) = '\0'; // add end-of-string
return buf; return buf;
} }

Loading…
Cancel
Save