strnlen.c

来自「Intercom 是一个 Unix系统上灵活的语音传输软件。支持标准音频压缩比如」· C语言 代码 · 共 37 行

C
37
字号
/*  strnlen.c -- substitution for the strnlen Glibc function    Copyright (C) 2001-2003  Shane Wegner    This file is part of Intercom.    Intercom is free software; you can redistribute it and/or modify it    under the terms of version 2 of the GNU General Public License as    published by the Free Software Foundation.    Intercom is distributed in the hope that it will be useful, but    WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    General Public License for more details.    You should have received a copy of version 2 of the GNU General Public    License along with Intercom; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    To contact the author, please send email to shane@cm.nu.    *//* $Id: strnlen.c,v 1.4 2003/02/13 20:22:49 shane Exp $ */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <string.h>size_t strnlen(const char *s, size_t maxlen){size_t n = 0;while(s[n])if (n == maxlen)return n;return n - 1;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?