Latest Publications

字符串函数

几个常见字符串处理函数

  1. /* *
  2. * str开头的函数部分
  3. * In the following functions, variables s and t are of type char *;
  4. * cs and ct are of type const char *; n is of type size_t;
  5. * and c is an int converted to char.
  6. */
  7.  
  8. // strcpy - copy string ct to string s, including '\0'; return s.
  9. char *strcpy(char *s, const char *ct)
  10. {
  11.     char *tmp = s;
  12.  
  13.     while ((*tmp++ = *ct++) != '\0')
  14.         /* nothing */;
  15.     return s;
  16. }
  17. <a href="http://www.juliuschen.com/archives/18.html#more-18" class="more-link">继续阅读 &raquo;</a>