File: stringy.cpp

package info (click to toggle)
sludge 2.2.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,852 kB
  • sloc: cpp: 32,432; sh: 1,237; makefile: 634; xml: 284
file content (18 lines) | stat: -rw-r--r-- 472 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "allfiles.h"
#include <string.h>

#include "newfatal.h"

char * copyString (const char * copyMe) {
	char * newString = new char [strlen (copyMe) + 1];
	if (! checkNew (newString)) return NULL;
	strcpy (newString, copyMe);
	return newString;
}

char * joinStrings (const char * s1, const char * s2) {
	char * newString = new char [strlen (s1) + strlen (s2) + 1];
	if (! checkNew (newString)) return NULL;
	sprintf (newString, "%s%s", s1, s2);
	return newString;
}