wcscpy() — ワイド文字ストリングのコピー
フォーマット
#include <wchar.h>
wchar_t *wcscpy(wchar_t *string1, const wchar_t *string2);
言語レベル
XPG4
スレッド・セーフ
はい
ワイド文字関数
詳細については、ワイド文字を参照してください。
説明
wcscpy() 関数は、(終了 wchar_t ヌル文字を含む) string2 の 内容を string1 にコピーします。
wcscpy() 関数は、 ヌル終了 wchar_t ストリング上で作動します。この関数のストリング引数には、ストリングの終わりを示す wchar_t ヌル文字が入っていなければ なりません。ヌル文字を含む必要があるのは string2 のみです。 境界検査は実行されません。
戻り値
wcscpy() 関数は string1 へのポインターを戻します。
例
この例では、source の内容を destination にコピーします。
#include <stdio.h>
#include <wchar.h>
#define SIZE 40
int main(void)
{
wchar_t source[ SIZE ] = L"This is the source string";
wchar_t destination[ SIZE ] = L"And this is the destination string";
wchar_t * return_string;
printf( "destination is originally = ¥"%ls¥"¥n", destination );
return_string = wcscpy( destination, source );
printf( "After wcscpy, destination becomes ¥"%ls¥"¥n", destination );
}
/**************** Output should be similar to: ******************
destination is originally = "And this is the destination string"
After wcscpy, destination becomes "This is the source string"
*/