please dont rip this site Prev Next

lstrcpyn info  Overview  Group

The lstrcpyn function copies a specified number of characters from a source string into a buffer.

LPTSTR lstrcpyn(

    LPTSTR lpString1,

// address of target buffer

    LPCTSTR lpString2,

// address of source string

    int iMaxLength 

// number of bytes or characters to copy

   );

Parameters

lpString1
Points to a buffer into which the function copies characters. The buffer must be large enough to contain the number of bytes (ANSI version) or characters (Unicode version) specified by iMaxLength, including room for a terminating null character.
lpString2
Points to a null-terminated string from which the function copies characters.
iMaxLength
Specifies the number bytes (ANSI version) or characters (Unicode version) to be copied from the string pointed to by lpString2 into the buffer pointed to by lpString1, including a terminating null character.

Return Values

If the function succeeds, the return value is a pointer to the buffer.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

Note that the buffer pointed to by lpString1 must be large enough to include a terminating null character, and the string length value specified by iMaxLength includes room for a terminating null character. Thus, the following code

TCHAR chBuffer[512] ;


lstrcpyn(chBuffer, "abcdefghijklmnop", 4) ;  

... copies the string "abc", followed by a terminating null character, to chBuffer.

See Also

lstrcat, lstrcmp, lstrcmpi, lstrcpy, lstrlen 


file: /Techref/os/win/api/win32/func/src/f56_1.htm, 3KB, , updated: 2000/4/7 11:19, local time: 2024/11/11 19:17,
TOP NEW HELP FIND: 
3.142.199.3:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/techref/os/win/api/win32/func/src/f56_1.htm"> lstrcpyn</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?