Files
XCSDD/docs/api/containers/string/cstr.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

37 lines
686 B
Markdown

# String::CStr
```cpp
const char* CStr() const;
```
返回指向以 null 结尾的 C 字符串的指针。
**参数:**
**返回:** 指向内部字符数组的指针,以 null 结尾
**复杂度:** O(1)
**示例:**
```cpp
#include "XCEngine/Containers/String.h"
#include <iostream>
#include <cstring>
int main() {
XCEngine::Containers::String s("Hello World");
const char* cstr = s.CStr();
std::cout << cstr << std::endl; // 输出: Hello World
std::cout << "Length: " << std::strlen(cstr) << std::endl; // 输出: Length: 11
return 0;
}
```
## 相关文档
- [String 总览](string.md) - 返回类总览
- [Length](size.md) - 获取长度