wcscpy() - ワイド文字ストリングのコピー

標準

標準/拡張機能 C/C++ 依存項目

ISO C 改訂
XPG4
XPG4.2
C99
Single UNIX Specification、バージョン 3

両方  

形式

#include <wchar.h>

wchar_t *wcscpy(wchar_t * __restrict__string1, const wchar_t * __restrict__string2);

機能説明

(終了ワイド NULL 文字を含む) string2 の 内容を string1 にコピーします。wcscpy() 関数は、NULL 文字で終了するワイド文字ストリングを操作します。この関数に対するストリング引数には、ストリングの終わりにマークを 付けるワイド NULL 文字が入っていなければなりません。境界検査は実行されません。

このワイド文字関数の動作は、現行ロケールの LC_CTYPE カテゴリーの影響を受けます。 カテゴリーを変更すると、未定義の結果が発生する可能性があります。

戻り値

wcscpy() は、string1 の値を戻します。

CELEBW08
⁄* CELEBW08                                      

   This example copies the contents of source to destination using              
   wcscpy().                                                                    

 *⁄                                                                             
#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 );         
}                                                                               
出力:
destination is originally = "And this is the destination string"
After wcscpy, destination becomes "This is the source string"

関連情報