YSTest: cstring.cpp 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

cstring.cpp
浏览该文件的文档.
1 /*
2 © 2009-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #include "ystdex/cstring.h"
29 #include <cstdio>
30
31 namespace ystdex
32 {
33
34 char*
35 strcpycat(char* d, const char* s1, const char* s2)
36 {
37 if(d)
38 {
39 if(s1)
40 std::strcpy(d, s1);
41 if(s2)
42 std::strcat(d, s2);
43 return d;
44 }
45 return {};
46 }
47
48 char*
49 strcatdup(const char* s1, const char* s2, void*(*fun)(size_t))
50 {
51 return strcpycat(static_cast<char*>(
52 fun((std::strlen(s1) + std::strlen(s2) + 1) * sizeof(char))), s1, s2);
53 }
54
55 } // namespace ystdex;
56
ystdex
特性测试宏。
Definition: ydef.h:822
ystdex::strcatdup
char * strcatdup(const char *, const char *, void *(*)(size_t)=std::malloc)
带空指针检查的字符串连接复制。
cstring.h
ISO C 标准字符串扩展。
CHRLib::d
_tDst * d
Definition: CharacterProcessing.h:139
ystdex::strcpycat
char * strcpycat(char *, const char *, const char *)
带空指针检查的字符串连接。
Definition: cstring.cpp:35