【水晶玻璃鞋 2】 strncpy, wcsncpy

Copy characeters from one string to another

char*strncpy( char *strDest,const char *strSource,size_t count );

      The strncpy functioncopies the initial count characters of strSource to strDest andreturns strDest.If count is less than or equal to the lengthof strSource, a null character is not appended automatically to the copiedstring. If count is greater than the length of strSource,the destination string is padded with null characters up to length count.The behavior of strncpy is undefined if the source and destinationstrings overlap. strncpy does not check for sufficient space in strDest,it istherefor a potential cause of buffer overruns. Keep in mind that strDest mustbe large enough to hold strSource and the closing '\0'; otherwise, a buffer overrun can occur. 

wchar_t *wcsncpy(wchar_t *strDest,const wchar_t *strSource,size_tcount);

   wcsncpy isthe wide-character version of strncpy. The arguments and return valueof wcsncpy vary accordingly. These two functions behave identicallyotherwise.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值