source: Main/trunk/Common/string.c@ 3

Last change on this file since 3 was 3, checked in by Nishi, on Sep 13, 2024 at 6:06:44 PM

string op works, log works too

  • Property svn:keywords set to Id
File size: 330 bytes
RevLine 
[2]1/* $Id: string.c 3 2024-09-13 09:06:44Z nishi $ */
[3]2
3#include <string.h>
4#include <stdlib.h>
5
6char* cm_strcat(const char* a, const char* b) {
7 char* str = malloc(strlen(a) + strlen(b) + 1);
8 memcpy(str, a, strlen(a));
9 memcpy(str + strlen(a), b, strlen(b));
10 str[strlen(a) + strlen(b)] = 0;
11 return str;
12}
13
14char* cm_strdup(const char* str) { return cm_strcat(str, ""); }
Note: See TracBrowser for help on using the repository browser.