⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sttrimnmax.c

📁 程序涵盖了设计FIR滤器的各种方法
💻 C
字号:
/*-------------- Telecommunications & Signal Processing Lab ---------------                             McGill UniversityRoutine:  int STtrimNMax (const char Si[], char So[], int N, int Maxchar)Purpose:  Copy at most N characters, trimming trailing white-spaceDescription:  This routine copies characters from the input string to the output string.  The length of the input string is considered to be equal to N less any  trailing white-space (as defined by isspace).  Characters are copied from  input string up to the minimum of the length of the input string and Maxchar.  A null character in the input string also terminates the transfer at that  point.  If the input string is longer than Maxchar, a string truncated  warning message is printed.Parameters:  <-  int STtrimNMax      Number of characters in the output string   -> const char Si[]      Input character string  <-  char So[]      Output character string.  This string is always null terminated, with      at most Maxchar characters not including the terminating null character.      If the input string is longer than Maxchar, only the first Maxchar      characters are copied and a warning message is printed.   -> int N      Number of characters to be transferred   -> int Maxchar      Maximum number of characters (not including the trailing null character)      to be placed in So.Author / revision:  P. Kabal  Copyright (C) 1999  $Revision: 1.11 $  $Date: 1999/06/04 22:34:58 $-------------------------------------------------------------------------*/static char rcsid[] = "$Id: STtrimNMax.c 1.11 1999/06/04 FilterDesign-v4r0a $";#include <ctype.h>#include <libtsp.h>#include <libtsp/nucleus.h>intSTtrimNMax (const char Si[], char So[], int N, int Maxchar){  const char *p;  int n, nc;  /* Determine the length of the input string */  p = Si;  for (n = 0; n < N; ++n, ++p)    if (*p == '\0')      break;  /* Trim trailing white-space */  for (p = Si+(n-1); n > 0 ; --n, --p)	/* n is the number of characters */    if (! isspace (*p))      break;  /* Copy the trimmed string to the output string */  nc = STcopyNMax (Si, So, n, Maxchar);  return nc;}

⌨️ 快捷键说明

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