语法:
#include
<string.h>
size_t strxfrm( char *str1, const char *str2,
size_t num );
功能:函数将字符串str2 的前num 个字符存储到字符串str1中。如果strcoll() 处理字符串str1
和旧的字符串str2, 返回值和strcmp()的处理结果一样。
示例:
#include <stdio.h>
#include <string.h>
void main(void)
{
char buffer[64] = "Jamsa's
1001 C/C++ Tips";
char target[64];
int length;
length = strxfrm(target,
buffer, sizeof(buffer));
printf("Length %d Target %s
Buffer %s\n", length,
target, buffer);
}
运行结果:
Length 23 Target Jamsa's 1001 C/C++ Tips Buffer Jamsa's 1001 C/C++
Tips