std::wcscpy(3)
π std::wcscpy(3) π
okay so this is the std::wcscpy(3) page, bestie, and it comes from the C++ Standard Libary (their spelling, not mine π). It's giving "copy a wide string" energy, and we're gonna get into it.
β¨ NAME β¨
std::wcscpy β literally std::wcscpy. That's the name. No notes. π
πΈ Synopsis πΈ
Defined in header <cwchar>:
wchar_t* wcscpy( wchar_t* dest, const wchar_t* src );
okay so what it does: it copies the wide string pointed to by src β including the terminating null wide character β into the wide character array pointed to by dest. slay.
β οΈ If the strings overlap, the behavior is undefined. bestie. do not overlap them. that is not the move. π
π Parameters π
destβ pointer to the wide character array to copy to.srcβ pointer to the null-terminated wide string to copy from.
π Return value π
It returns dest. that's it, that's the whole return value. iconic. β¨
π¦ Example π¦
The page literally says // Run this code, so go off:
#include <clocale>
#include <cwchar>
#include <iostream>
#include <memory>
int main()
{
const wchar_t* src = L"η¬ means dog";
// src[0] = L'η'; // can't modify string literal
auto dst = std::make_unique<wchar_t[]>(std::wcslen(src) + 1); // +1
for the null
std::wcscpy(dst.get(), src);
dst[0] = L'η';
std::setlocale(LC_ALL, "en_US.utf8");
std::wcout.imbue(std::locale(""));
std::wcout << src << '\n' << dst.get() << '\n';
}
π Output π
η¬ means dog
η means dog
π¦ See also π¦
wcsncpyβ copies a certain amount of wide characters from one string to another. (function)wmemcpyβ copies a certain amount of wide characters between two non-overlapping arrays. (function)strcpyβ copies one string to another. (function)- C documentation for
wcscpy.
π source: http://cppreference.com β’ version/date: 2024.06.10 β’ page: std::wcscpy(3) π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms