标签:ret const enc 超过 tran 字符 imu starting span
strchr函数与strrchr函数
1 Action() 2 { 3 // strchr函数用于查找指定字符在一个字符串中第1次出现的位置,然后返回指向该位置的指针; 4 // strrchr函数用户查找指定字符在一个字符串中最后1次出现的位置,然后返回指向该位置的指针。 5 // 语法结构 6 // char *strchr(const char *string,int c); 7 // char *strrchr(const char *string,int c); 8 9 10 char *string = "I‘m a young soul in this very strange world"; 11 char *first_a, *last_a; 12 13 first_a = (char *)strchr(string, ‘a‘); 14 lr_output_message("The first occurrence of a: %s", first_a); 15 16 last_a = (char *)strrchr(string, ‘a‘); 17 lr_output_message("The last occurrence of a: %s", last_a); 18 19 return 0; 20 } 21 ----------------------------------------------------------------------------------- 22 Running Vuser... 23 Starting iteration 1. 24 Maximum number of concurrent connections per server: 6 [MsgId: MMSG-26989] 25 Starting action Action. 26 Action.c(14): The first occurrence of a: a young soul in this very strange world 27 Action.c(17): The last occurrence of a: ange world 28 Ending action Action. 29 Ending iteration 1. 30 Ending Vuser...
strcpy函数与strncpy函数
1 Action() 2 { 3 // strcpy函数是把一个字符串复制到另一个字符串中; 4 // strncpy函数是把一个字符串中的指定长度复制到另一个字符串中,如果指定长度超过了字符串长度,则会复制整个字符串。 5 // 语法结构 6 // strcpy: char *strcpy(char *dest, const char *source); 7 // strncpy: char *strncpy(char *dest,const char *source, size_t n); 8 // 参数dest是目标字符串,source是源字符串,n是要复制的长度。 9 10 11 char test[50]; 12 char ntest[50]; 13 strcpy(test, "Copies one string to another."); 14 lr_output_message("%s", test); 15 16 strncpy(ntest, "Copies the first n characters of one string to another?", 30); 17 lr_output_message("%s", ntest); 18 19 return 0; 20 } 21 22 ---------------------------------------------------------------------------------- 23 Running Vuser... 24 Starting iteration 1. 25 Maximum number of concurrent connections per server: 6 [MsgId: MMSG-26989] 26 Starting action Action. 27 Action.c(14): Copies one string to another. 28 Action.c(17): Copies the first n characters 29 Ending action Action. 30 Ending iteration 1. 31 Ending Vuser...
标签:ret const enc 超过 tran 字符 imu starting span
原文地址:http://www.cnblogs.com/jxdong116/p/7231819.html