我看过《女人不哭》
章子君的曲折生活,奋斗历程也让我更坚定的度过了那段日子。她最后还是成功了,事业and情感。从她身上,我学会:
坚强、忍耐、等待
LR_strcat and LR_strcpy
上一篇 /
下一篇 2007-09-03 16:24:50
/ 个人分类:LR_String Functions
一、strcat
Concatenates two strings.
char *strcat ( char *to, const char *from );
to |
The string at the end of which the from string is concatenated. |
from |
The string concatenated to the end of the to string. |
strcat concatenates two strings.
二、strcpy
Copies one string to another.
char *strcpy ( char *dest, const char *source );
dest |
The destination string into which source is copied. (目的) |
source |
The string that is copied. (源) |
strcpy copies one string to another.
注意:
注意将字符串或者字符串常量放在一个字符变量中,而且字符变量需要设置长度,如果不设置会出错。如下:
Action.c(16): Error: C interpreter run time error: Action.c (16): Error -- memory violation : Exception ACCESS_VIOLATION received.
Action.c(16): Notify: CCI trace: Action.c(16): strcat(0, 0x00e3023e "aaa")
.
Action.c(16): Notify: CCI trace: Compiled_code(0): Action()
.
Action()
{
char *a="aaa";
char *b="bbb";
char c[1024];
char fullpath[1024], *filename = "logfile.txt";
strcpy(fullpath, "把它考到fullpath中");
strcat(fullpath, "【这个字符连接到fullpath后面】");
strcat(fullpath, filename);
lr_output_message("Full path of file is %s", fullpath);
strcat(c,a);
strcat(c,b);
strcat(c,a);
lr_output_message("%s",a);
lr_output_message("%s",b);
lr_output_message("%s",c);
return 0;
}
收藏
举报
TAG:
LR_string_funtion