wcscpy


wcscpy

Copies a wide string to another location

 #include <wchar.h> wchar_t *wcscpy ( wchar_t * restrict s1 , const wchar_t * restrict s2  ); 

The wcscpy( ) function copies the wide string addressed by src to the char array addressed by dest, and returns the value of its first argument, which points to the new copy of the string.

There is no limit to the number of wide characters wcscpy( ) may write before it encounters a null wide character in the source string. It is up to you the programmer to make sure there is enough storage available to accommodate the string, including its terminator character. Consider using wcsncpy( ) instead to reduce the risk of buffer overflows. You must also make sure that the locations that wcscpy( ) reads from and writes to do not overlap.

Example

 struct record {   wchar_t name[64];   int age;   _Bool male, smoking, discount; } this; int results; wprintf( L"Last name: " ); results = wscanf( L"%63l[^\n]", this.name ); if ( results < 1 )   wcscpy( this.name,  L"[Name not available]" ); wprintf( L"%ls\n", this.name ); 

See Also

wcsncpy( ), strcpy( ), strncpy( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net