C语言库函数(六)

C语言库函数全面解读CHM版 C语言库函数是一组预先编写好的代码集合,这些函数封装了常见的功能,比如数据处理、数学计算、字符串操作等。程序员可以直接调用这些库函数,不必从头开始编写重复的代码,大大提高了开发效率。 阅读详情

函数名: sound 
功  能: 以指定频率打开PC扬声器 
用  法: void sound(unsigned frequency); 
程序例: 

/* Emits a 7-Hz tone for 10 seconds. 
   Your PC may not be able to emit a 7-Hz tone. */ 
#include <dos.h> 

int main(void) 
{ 
   sound(7); 
   delay(10000); 
   nosound(); 
   return 0; 
} 
  
  
  

函数名: spawnl 
功  能: 创建并运行子程序 
用  法: int spawnl(int mode, char *pathname, char *arg0, 
     arg1, ... argn, NULL); 
程序例: 

#include <process.h> 
#include <stdio.h> 
#include <conio.h> 

int main(void) 
{ 
   int result; 

   clrscr(); 
   result = spawnl(P_WAIT, "tcc.exe", NULL); 
   if (result == -1) 
   { 
      perror("Error from spawnl"); 
      exit(1); 
   } 
   return 0; 
} 
  
  

函数名: spawnle 
功  能: 创建并运行子程序 
用  法: int spawnle(int mode, char *pathname, char *arg0, 
      arg1,..., argn, NULL); 
程序例: 

/* spawnle() example */ 

#include <process.h> 
#include <stdio.h> 
#include <conio.h> 

int main(void) 
{ 
   int result; 

   clrscr(); 
   result = spawnle(P_WAIT, "tcc.exe", NULL, NULL); 
   if (result == -1) 
   { 
      perror("Error from spawnle"); 
      exit(1); 
   } 
   return 0; 
} 
  
  
  

函数名: sprintf 
功  能: 送格式化输出到字符串中 
用  法: int sprintf(char *string, char *farmat [,argument,...]); 
程序例: 

#include <stdio.h> 
#include <math.h> 

int main(void) 
{ 
   char buffer[80]; 

   sprintf(buffer, "An approximation of Pi is %f/n", M_PI); 
   puts(buffer); 
   return 0; 
} 
  
  

函数名: sqrt 
功  能: 计算平方根 
用  法: double sqrt(double x); 
程序例: 

#include <math.h> 
 #include <stdio.h> 

 int main(void) 
 { 
    double x = 4.0, result; 

    result = sqrt(x); 
    printf("The square root of %lf is %lf/n", x, result); 
    return 0; 
} 
  

函数名: srand 
功  能: 初始化随机数发生器 
用  法: void srand(unsigned seed); 
程序例: 

#include <stdlib.h> 
#include <stdio.h> 
#include <time.h> 

int main(void) 
{ 
   int i; 
   time_t t; 

   srand((unsigned) time(&t)); 
   printf("Ten random numbers from 0 to 99/n/n"); 
   for(i=0; i<10; i++) 
       printf("%d/n", rand() % 100); 
   return 0; 
} 
  
  

函数名: sscanf 
功  能: 执行从字符串中的格式化输入 
用  法: int sscanf(char *string, char *format[,argument,...]); 
程序例: 

#include <stdio.h> 
#include <conio.h> 

int main(void) 
{ 
   char label[20]; 
   char name[20]; 
   int entries = 0; 
   int loop, age; 
   double salary; 

   struct Entry_struct 
   { 
      char  name[20]; 
      int   age; 
      float salary; 
   } entry[20]; 

/* Input a label as a string of characters restricting to 20 characters */ 
   printf("/n/nPlease enter a label for the chart: "); 
   scanf("%20s", label); 
   fflush(stdin);  /* flush the input stream in case of bad input */ 

/* Input number of entries as an integer */ 
   printf("How many entries will there be? (less than 20) "); 
   scanf("%d", &entries); 
   fflush(stdin);   /* flush the input stream in case of bad input */ 

/* input a name restricting input to only letters upper or lower case */ 
   for (loop=0;loop<entries;++loop) 
   { 
      printf("Entry %d/n", loop); 
      printf("  Name   : "); 
      scanf("%[A-Za-z]", entry[loop].name); 
      fflush(stdin);  /* flush the input stream in case of bad input */ 

/* input an age as an integer */ 
      printf("  Age    : "); 
      scanf("%d", &entry[loop].age); 
      fflush(stdin);  /* flush the input stream in case of bad input */ 

/* input a salary as a float */ 
      printf("  Salary : "); 
      scanf("%f", &entry[loop].salary); 
      fflush(stdin); /* flush the input stream in case of bad input */ 
   } 

/* Input a name, age and salary as a string, integer, and double */ 
   printf("/nPlease enter your name, age and salary/n"); 
   scanf("%20s %d %lf", name, &age, &salary); 
  

/* Print out the data that was input */ 
   printf("/n/nTable %s/n",label); 
   printf("Compiled by %s  age %d  $%15.2lf/n", name, age, salary); 
   printf("-----------------------------------------------------/n"); 
   for (loop=0;loop<entries;++loop) 
      printf("%4d | %-20s | %5d | %15.2lf/n", 
         loop + 1, 
  entry[loop].name, 
  entry[loop].age, 
  entry[loop].salary); 
   printf("-----------------------------------------------------/n"); 
   return 0; 
} 
  
  

函数名: stat 
功  能: 读取打开文件信息 
用  法: int stat(char *pathname, struct stat *buff); 
程序例: 

#include <sys/stat.h> 
#include <stdio.h> 
#include <time.h> 

#define FILENAME "TEST.$$$" 

int main(void) 
{ 
   struct stat statbuf; 
   FILE *stream; 

   /* open a file for update */ 
   if ((stream = fopen(FILENAME, "w+")) == NULL) 
   { 
      fprintf(stderr, "Cannot open output file./n"); 
      return(1); 
   } 

   /* get information about the file */ 
   stat(FILENAME, &statbuf); 

   fclose(stream); 

   /* display the information returned */ 
   if (statbuf.st_mode & S_IFCHR) 
      printf("Handle refers to a device./n"); 
   if (statbuf.st_mode & S_IFREG) 
      printf("Handle refers to an ordinary file./n"); 
   if (statbuf.st_mode & S_IREAD) 
      printf("User has read permission on file./n"); 
   if (statbuf.st_mode & S_IWRITE) 
      printf("User has write permission on file./n"); 

   printf("Drive letter of file: %c/n", 'A'+statbuf.st_dev); 
   printf("Size of file in bytes: %ld/n", statbuf.st_size); 
   printf("Time file last opened: %s/n", ctime(&statbuf.st_ctime)); 
   return 0; 
} 
  
  
  

函数名: _status87 
功  能: 取浮点状态 
用  法: unsigned int _status87(void); 
程序例: 

#include <stdio.h> 
#include <float.h> 

int main(void) 
{ 
   float x; 
   double y = 1.5e-100; 

   printf("Status 87 before error: %x/n", _status87()); 

   x = y;  /* <-- force an error to occur */ 
   y = x; 

   printf("Status 87 after error : %x/n", _status87()); 
   return 0; 
} 
  
  

函数名: stime 
功  能: 设置时间 
用  法: int stime(long *tp); 
程序例: 

#include <stdio.h> 
#include <time.h> 
#include <dos.h> 

int main(void) 
{ 
   time_t t; 
   struct tm *area; 

   t = time(NULL); 
   area = localtime(&t); 
   printf("Number of seconds since 1/1/1970 is: %ld/n", t); 
   printf("Local time is: %s", asctime(area)); 

   t++; 
   area = localtime(&t); 
   printf("Add a second:  %s", asctime(area)); 

   t += 60; 
   area = localtime(&t); 
   printf("Add a minute:  %s", asctime(area)); 

   t += 3600; 
   area = localtime(&t); 
   printf("Add an hour:   %s", asctime(area)); 

   t += 86400L; 
   area = localtime(&t); 
   printf("Add a day:     %s", asctime(area)); 

   t += 2592000L; 
   area = localtime(&t); 
   printf("Add a month:   %s", asctime(area)); 

   t += 31536000L; 
   area = localtime(&t); 
   printf("Add a year:    %s", asctime(area)); 
   return 0; 
} 
  
  
  

函数名: stpcpy 
功  能: 拷贝一个字符串到另一个 
用  法: char *stpcpy(char *destin, char *source); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
{ 
   char string[10]; 
   char *str1 = "abcdefghi"; 

   stpcpy(string, str1); 
   printf("%s/n", string); 
   return 0; 
} 
  
  
  

函数名: strcat 
功  能: 字符串拼接函数 
用  法: char *strcat(char *destin, char *source); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char destination[25]; 
   char *blank = " ", *c = "C++", *Borland = "Borland"; 

   strcpy(destination, Borland); 
   strcat(destination, blank); 
   strcat(destination, c); 

   printf("%s/n", destination); 
   return 0; 
} 
  
  
  

函数名: strchr 
功  能: 在一个串中查找给定字符的第一个匹配之处/ 
用  法: char *strchr(char *str, char c); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
 { 
    char string[15]; 
    char *ptr, c = 'r'; 

    strcpy(string, "This is a string"); 
    ptr = strchr(string, c); 
    if (ptr) 
       printf("The character %c is at position: %d/n", c, ptr-string); 
    else 
       printf("The character was not found/n"); 
    return 0; 
 } 
  
  
  

函数名: strcmp 
功  能: 串比较 
用  法: int strcmp(char *str1, char *str2); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
 { 
    char *buf1 = "aaa", *buf2 = "bbb", *buf3 = "ccc"; 
    int ptr; 

    ptr = strcmp(buf2, buf1); 
    if (ptr > 0) 
       printf("buffer 2 is greater than buffer 1/n"); 
    else 
       printf("buffer 2 is less than buffer 1/n"); 

    ptr = strcmp(buf2, buf3); 
    if (ptr > 0) 
       printf("buffer 2 is greater than buffer 3/n"); 
    else 
       printf("buffer 2 is less than buffer 3/n"); 

    return 0; 
 } 
  
  
  

函数名: strncmpi 
功  能: 将一个串中的一部分与另一个串比较, 不管大小写 
用  法: int strncmpi(char *str1, char *str2, unsigned maxlen); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *buf1 = "BBB", *buf2 = "bbb"; 
   int ptr; 

   ptr = strcmpi(buf2, buf1); 

   if (ptr > 0) 
      printf("buffer 2 is greater than buffer 1/n"); 

   if (ptr < 0) 
      printf("buffer 2 is less than buffer 1/n"); 

   if (ptr == 0) 
      printf("buffer 2 equals buffer 1/n"); 

   return 0; 
} 
  
  
  

函数名: strcpy 
功  能: 串拷贝 
用  法: char *strcpy(char *str1, char *str2); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
 { 
    char string[10]; 
    char *str1 = "abcdefghi"; 

    strcpy(string, str1); 
    printf("%s/n", string); 
    return 0; 
 } 
  
  
  

函数名: strcspn 
功  能: 在串中查找第一个给定字符集内容的段 
用  法: int strcspn(char *str1, char *str2); 
程序例: 

#include <stdio.h> 
#include <string.h> 
#include <alloc.h> 

int main(void) 
 { 
    char *string1 = "1234567890"; 
    char *string2 = "747DC8"; 
    int length; 

    length = strcspn(string1, string2); 
    printf("Character where strings intersect is at position %d/n", length); 

    return 0; 
 } 
  
  
  

函数名: strdup 
功  能: 将串拷贝到新建的位置处 
用  法: char *strdup(char *str); 
程序例: 

#include <stdio.h> 
#include <string.h> 
#include <alloc.h> 

int main(void) 
 { 
    char *dup_str, *string = "abcde"; 

    dup_str = strdup(string); 
    printf("%s/n", dup_str); 
    free(dup_str); 

    return 0; 
 } 
  
  
  

函数名: stricmp 
功  能: 以大小写不敏感方式比较两个串 
用  法: int stricmp(char *str1, char *str2); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *buf1 = "BBB", *buf2 = "bbb"; 
   int ptr; 

   ptr = stricmp(buf2, buf1); 

   if (ptr > 0) 
      printf("buffer 2 is greater than buffer 1/n"); 

   if (ptr < 0) 
      printf("buffer 2 is less than buffer 1/n"); 

   if (ptr == 0) 
      printf("buffer 2 equals buffer 1/n"); 

   return 0; 
} 
  
  

函数名: strerror 
功  能: 返回指向错误信息字符串的指针 
用  法: char *strerror(int errnum); 
程序例: 

#include <stdio.h> 
#include <errno.h> 

int main(void) 
{ 
   char *buffer; 
   buffer = strerror(errno); 
   printf("Error: %s/n", buffer); 
   return 0; 
} 
  
  
  

函数名: strcmpi 
功  能: 将一个串与另一个比较, 不管大小写 
用  法: int strcmpi(char *str1, char *str2); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *buf1 = "BBB", *buf2 = "bbb"; 
   int ptr; 

   ptr = strcmpi(buf2, buf1); 

   if (ptr > 0) 
      printf("buffer 2 is greater than buffer 1/n"); 

   if (ptr < 0) 
      printf("buffer 2 is less than buffer 1/n"); 

   if (ptr == 0) 
      printf("buffer 2 equals buffer 1/n"); 

   return 0; 
} 
  
  
  

函数名: strncmp 
功  能: 串比较 
用  法: int strncmp(char *str1, char *str2, int maxlen); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int  main(void) 

{ 
   char *buf1 = "aaabbb", *buf2 = "bbbccc", *buf3 = "ccc"; 
   int ptr; 

   ptr = strncmp(buf2,buf1,3); 
   if (ptr > 0) 
      printf("buffer 2 is greater than buffer 1/n"); 
   else 
      printf("buffer 2 is less than buffer 1/n"); 

   ptr = strncmp(buf2,buf3,3); 
   if (ptr > 0) 
      printf("buffer 2 is greater than buffer 3/n"); 
   else 
      printf("buffer 2 is less than buffer 3/n"); 

   return(0); 
} 
  
  

函数名: strncmpi 
功  能: 把串中的一部分与另一串中的一部分比较, 不管大小写 
用  法: int strncmpi(char *str1, char *str2); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *buf1 = "BBBccc", *buf2 = "bbbccc"; 
   int ptr; 

   ptr = strncmpi(buf2,buf1,3); 

   if (ptr > 0) 
      printf("buffer 2 is greater than buffer 1/n"); 

   if (ptr < 0) 
      printf("buffer 2 is less than buffer 1/n"); 

   if (ptr == 0) 
      printf("buffer 2 equals buffer 1/n"); 

   return 0; 
} 
  
  

函数名: strncpy 
功  能: 串拷贝 
用  法: char *strncpy(char *destin, char *source, int maxlen); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
{ 
   char string[10]; 
   char *str1 = "abcdefghi"; 

   strncpy(string, str1, 3); 
   string[3] = '/0'; 
   printf("%s/n", string); 
   return 0; 
} 
  
  

函数名: strnicmp 
功  能: 不注重大小写地比较两个串 
用  法: int strnicmp(char *str1, char *str2, unsigned maxlen); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *buf1 = "BBBccc", *buf2 = "bbbccc"; 
   int ptr; 

   ptr = strnicmp(buf2, buf1, 3); 

   if (ptr > 0) 
      printf("buffer 2 is greater than buffer 1/n"); 

   if (ptr < 0) 
      printf("buffer 2 is less than buffer 1/n"); 

   if (ptr == 0) 
      printf("buffer 2 equals buffer 1/n"); 

   return 0; 
} 
  
  
  

函数名: strnset 
功  能: 将一个串中的所有字符都设为指定字符 
用  法: char *strnset(char *str, char ch, unsigned n); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
{ 
   char *string = "abcdefghijklmnopqrstuvwxyz"; 
   char letter = 'x'; 

   printf("string before strnset: %s/n", string); 
   strnset(string, letter, 13); 
   printf("string after  strnset: %s/n", string); 

   return 0; 
} 
  
  

函数名: strpbrk 
功  能: 在串中查找给定字符集中的字符 
用  法: char *strpbrk(char *str1, char *str2); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
{ 
   char *string1 = "abcdefghijklmnopqrstuvwxyz"; 
   char *string2 = "onm"; 
   char *ptr; 

   ptr = strpbrk(string1, string2); 

   if (ptr) 
      printf("strpbrk found first character: %c/n", *ptr); 
   else 
      printf("strpbrk didn't find character in set/n"); 

   return 0; 
} 
  
  
  

函数名: strrchr 
功  能: 在串中查找指定字符的最后一个出现 
用  法: char *strrchr(char *str, char c); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char string[15]; 
   char *ptr, c = 'r'; 

   strcpy(string, "This is a string"); 
   ptr = strrchr(string, c); 
   if (ptr) 
      printf("The character %c is at position: %d/n", c, ptr-string); 
   else 
      printf("The character was not found/n"); 
   return 0; 
} 
  
  
  

函数名: strrev 
功  能: 串倒转 
用  法: char *strrev(char *str); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *forward = "string"; 

   printf("Before strrev(): %s/n", forward); 
   strrev(forward); 
   printf("After strrev():  %s/n", forward); 
   return 0; 
} 
  

函数名: strset 
功  能: 将一个串中的所有字符都设为指定字符 
用  法: char *strset(char *str, char c); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
{ 
   char string[10] = "123456789"; 
   char symbol = 'c'; 

   printf("Before strset(): %s/n", string); 
   strset(string, symbol); 
   printf("After strset():  %s/n", string); 
   return 0; 
} 
  
  
  

函数名: strspn 
功  能: 在串中查找指定字符集的子集的第一次出现 
用  法: int strspn(char *str1, char *str2); 
程序例: 

#include <stdio.h> 
#include <string.h> 
#include <alloc.h> 

int main(void) 
{ 
   char *string1 = "1234567890"; 
   char *string2 = "123DC8"; 
   int length; 

   length = strspn(string1, string2); 
   printf("Character where strings differ is at position %d/n", length); 
   return 0; 
} 
  
  

函数名: strstr 
功  能: 在串中查找指定字符串的第一次出现 
用  法: char *strstr(char *str1, char *str2); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
{ 
   char *str1 = "Borland International", *str2 = "nation", *ptr; 

   ptr = strstr(str1, str2); 
   printf("The substring is: %s/n", ptr); 
   return 0; 
} 
  
  

函数名: strtod 
功  能: 将字符串转换为double型值 
用  法: double strtod(char *str, char **endptr); 
程序例: 

#include <stdio.h> 
#include <stdlib.h> 

int main(void) 
{ 
   char input[80], *endptr; 
   double value; 

   printf("Enter a floating point number:"); 
   gets(input); 
   value = strtod(input, &endptr); 
   printf("The string is %s the number is %lf/n", input, value); 
   return 0; 
} 
  
  
  

函数名: strtok 
功  能: 查找由在第二个串中指定的分界符分隔开的单词 
用  法: char *strtok(char *str1, char *str2); 
程序例: 

#include <string.h> 
#include <stdio.h> 

int main(void) 
{ 
   char input[16] = "abc,d"; 
   char *p; 

   /* strtok places a NULL terminator 
   in front of the token, if found */ 
   p = strtok(input, ","); 
   if (p)   printf("%s/n", p); 

   /* A second call to strtok using a NULL 
   as the first parameter returns a pointer 
   to the character following the token  */ 
   p = strtok(NULL, ","); 
   if (p)   printf("%s/n", p); 
   return 0; 
} 
  
  
  

函数名: strtol 
功  能: 将串转换为长整数 
用  法: long strtol(char *str, char **endptr, int base); 
程序例: 

#include <stdlib.h> 
#include <stdio.h> 

int main(void) 
{ 
   char *string = "87654321", *endptr; 
   long lnumber; 

   /* strtol converts string to long integer  */ 
   lnumber = strtol(string, &endptr, 10); 
   printf("string = %s  long = %ld/n", string, lnumber); 

   return 0; 
} 
  

函数名: strupr 
功  能: 将串中的小写字母转换为大写字母 
用  法: char *strupr(char *str); 
程序例: 

#include <stdio.h> 
#include <string.h> 

int main(void) 
{ 
   char *string = "abcdefghijklmnopqrstuvwxyz", *ptr; 

   /* converts string to upper case characters */ 
   ptr = strupr(string); 
   printf("%s/n", ptr); 
   return 0; 
} 
  
  
  

函数名: swab 
功  能: 交换字节 
用  法: void swab (char *from, char *to, int nbytes); 
程序例: 

#include <stdlib.h> 
#include <stdio.h> 
#include <string.h> 

char source[15] = "rFna koBlrna d"; 
char target[15]; 

int main(void) 
{ 
   swab(source, target, strlen(source)); 
   printf("This is target: %s/n", target); 
   return 0; 
} 
  
  
  

函数名: system 
功  能: 发出一个DOS命令 
用  法: int system(char *command); 
程序例: 

#include <stdlib.h> 
#include <stdio.h> 

int main(void) 
{ 
   printf("About to spawn command.com and run a DOS command/n"); 
   system("dir"); 
   return 0; 
} 

C语言库函数大全与实战应用 本文还有配套的精品资源,点击获取 简介:C语言库函数是编程中不可或缺的工具,提供了标准输入输出、数学计算、字符串操作、内存管理、错误处理等基础功能。掌握这些库函数对每个C程序员而言是基本要求。本文详细介绍了输入输出、数学、字符串处理、内存管理、错误处理等领域的常用函数及其用法,同时强调了理解参数、返回值和潜在错误的重要性。通过熟悉标准库头文件和实践应用,可以有效提升编程效率... 阅读详情

相关推荐

c语言如何编程出声音,C语言播放声音最简单的两种方法.zip

c语言如何编程出声音,C语言播放声音最简单的两种方法.zip

c语言程序暂停数秒的函数,C++中的声音处理 在传统Turbo C环境中,如果想用C语言控制电脑发声,可以用Sound函数。在VC6.6环境中如果想控制电脑发声则采用Beep函数。原型为: Beep(...

Presentation on theme: "C++中的声音处理 在传统Turbo C环境中,如果想用C语言控制电脑发声,可以用Sound函数。在VC6.6环境中如果想控制电脑发声则采用Beep函数。原型为: Beep(频率,持续时间) , 单位毫秒 暂停程序执行使用Sleep函数 Sleep(持续时间), 单位毫秒 引用这两个函数时,必须包含头文件"— Presentation transcr...

weixin_36308612的博客 672

使用3dmax Morpher制作Unity表情动画

关于游戏人物的面部表情动画 方案一:如果面部骨骼数丰富的话,可以直接做骨骼动画 方案二:采用变形器(3dmax是Morpher,maya是blendshape)修改相应通道的权重值来做表情动画 本文简述方案二的做法。 说明:本文截图中3dsMax版本为2017。笔者第一次使用3dsMax,欢迎指正。 3dmax中导入人物模型,选择需要变形的对象,即head。当前对象附带skin信息。 ...

写作帮助思考 2万+

数字语音处理——用sound函数播放喀秋莎(附赠歌唱动荡的青春)

数字语音处理——用sound函数播放喀秋莎(附赠歌唱动荡的青春) 上课老师提到了sound函数,一个非常简单的函数,sound - 将信号数据矩阵转换为声音。以下为其用法: sound(y) //以默认采样率 8192 赫兹向扬声器发送音频信号 y。 sound(y,Fs) //以采样率 Fs 向扬声器发送音频信号 y。 sound(y,Fs,nBits) //对音频信号 y 使用 nBits 的采样位数。 在这里用第一种用法即可。 首先编写一个生成波形的函数gen_wave。 // An highlig

weixin_47255475的博客 1678

【GIS效率手册】告别C盘爆满:三步重置ArcMap默认地理数据库路径

本文针对ArcMap用户C盘空间常被占满的问题,提供了三步重置默认地理数据库路径的详细教程。通过修改地图文档属性,将数据存储位置从C盘迁移至其他驱动器,不仅能有效释放系统盘空间,还能提升数据管理效率与安全性,是GIS数据规范化管理的关键一步。

g2h3i4j5的博客 545

EndNote全文检索实战:如何快速配置学校图书馆资源并精准查找文献

本文详细介绍了EndNote全文检索功能的实战配置方法,核心在于通过正确设置OpenURL链接解析器,无缝对接学校图书馆资源,实现一键精准获取文献全文。文章提供了从理解机制、四步配置法到进阶技巧的完整指南,帮助科研人员高效管理海量PDF,构建个人知识体系,大幅提升文献调研与写作效率。

weixin_29228781的博客 280

matlab音频处理相关函数的用法:sound、wavwrite、audiowrite

Name,Value指名称-值对组参数(官网上的称呼),具体来说是给其定义具体细节的参数,看例子吧。‘BitsPerSample’,24指每个样本点用24为数(数据的长短决定了文件的质量和大小)y指要写入的音频数据,比如有一个序列data,就可以把y的位置写成data。当然后面还有‘title’,‘artist’之类的,一般用不上。wavwrite函数的功能是将数据保存为wav格式的音频文件。Fs为取样率,一般音频信号的取样率为8000Hz。sound函数是将数据(矩阵)变成声音播放。

诚朴勇毅 3664

基于树莓派5的AR头显开发:从硬件选型到Unity整合全解析

增强现实(AR)技术通过将虚拟信息叠加到真实世界,为用户提供沉浸式交互体验。其核心原理依赖于计算机视觉进行环境感知与空间定位,并结合实时3D渲染实现虚实融合。在工程实践中,嵌入式平台因其低成本、低功耗特性,成为探索AR应用边界的重要载体。本项目以树莓派5为核心,通过集成OpenCV进行ArUco标记识别实现精准空间定位,并利用MediaPipe完成手势交互,最终在Unity引擎中完成虚实场景的实时渲染与融合,为开发者提供了一个完整的、可亲手实践的AR系统开发方案。

weixin_32430941的博客 254

函数声音C语言的发声程序

近期一直在查找函数声音之类的问题,上午正好有机会和大家分享一下.     C语言盘算机发音程序     [ 问题的提出]  曲谱的1 、2 、3 、4、5 、6 、7 ,加上高低音可以谱出动人的曲子,请编写程     序,使盘算机可以播放歌曲。     [ 分析]  播放歌曲意味着让盘算机发声,声音从 PC 机内的扬声器发出,所以这个问题将与     硬件扬声器电路有关。     [ ...

weixin_34280237的博客 3687

关于RTP时间戳以及播放器对时间戳的处理

首先,了解时间戳几个基本概念: 时间戳单位:时间戳计算的单位不是秒之类的单位,而是由采样频率所代替的单位,这样做的目的就是为了是时间戳单位更为精准。比如说一个音频的采样频率为8000Hz,那么我们可以把时间戳单位设为1 / 8000。 时间戳增量:相邻两帧之间的时间差(以时间戳单位为基准)。 采样频率: 有些地方也叫时钟频率,即 每秒钟抽取样本的次数,例如音频的采...

toshiba689的专栏 3052

【UNet 改进 | 注意机制篇】UNet引入CA注意力机制(2021 CVPR),二次创新

在医学图像分割任务中,病灶区域往往形态各异、边界模糊,且经常与周围组织的对比度较低,这要求模型具备极强的特征提取和细节辨别能力。传统的U-Net网络虽然通过跳跃连接融合了多尺度特征,但在处理复杂语义和精细边缘时仍有不足,尤其是在捕获特征时常常忽略位置信息。为了解决这些痛点,本文引入了在计算机视觉领域表现出色的 CA(Coordinate Attention,协调注意力)机制。CA 巧妙地将位置信息嵌入到了通道注意力中,通过水平和垂直两个方向的一维池化,同时捕获长距离依赖和精确的位置坐标。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 187

C语言库函数大全及应用实例六

                                             [编程资料]C语言库函数大全及应用实例六 函数名: getlinesettings 功 能: 取当前线型、模式和宽度 用 法: void far getlinesettings(struct linesettingstype far *lininfo): 程序例: #i nclude #i nc...

weixin_34405354的博客 159

ardupilot开发 --- MavLink 篇

ardupilot开发 --- MavLink 篇

记录老板的每次pua,分享领导每天的毒鸡汤... 4252

C语言库函数— qsort () 详解

C语言库函数qsort()详细介绍

qq_74009838的博客 1万+

simulink构建一个基于 BP(反向传播)神经网络 的自适应 PID 控制系统

本文介绍了基于BP神经网络的自适应PID控制系统设计方法。系统通过神经网络实时调整PID参数,实现智能控制。主要内容包括:1)系统架构设计,采用误差反馈和在线学习机制;2)详细建模步骤,从被控对象定义到神经网络结构设计;3)S-Function实现核心算法,包含前向传播、PID计算和反向传播;4)仿真结果分析,显示神经网络PID在响应速度、超调控制和鲁棒性方面的优势;5)进阶建议和常见问题解决方案。该方法突破了传统PID的局限性,实现了具有自我学习能力的智能控制。

xiaoheshang_123的博客 53

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

C语言库函数

函数说明:每一个打开的文件都有一个读写位置,当打开文件时通常其读写位置是指向文件开头,若是以附加的方式打开文件(如 O_APPEND),则读写位置会指向文件尾。当read()或wirte()时,读写位置会随之增加,lseek()便是用来控制文件的读写位置。// 目录文件内部偏移。// 权限0777(完全开放)// 目录项缓冲区(通常4KB)mode_t st_mode;// 文件类型和权限位。// 文件大小(字节)

weixin_55608863的博客 2328

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

C语言库函数查找工具MSDN

一、前言 库函数在我们写程序的时候会在很大程度上提高我们的效率,我知道很多人可能像我一样,很多时候并不是不知道可以用库函数来实现,但就是不知道库函数如何使用,所以今天呢博主就来推荐资源了——C语言库函数查找工具《MSDN》(百度网盘提取码:MSDN),后面将会演示如何使用的,同时博客还给大家推荐一些链接,也可以查看的:推荐大家使用英文版的,看不懂也可以用谷歌翻译哟 cplusplus.com zh.cppreference.com 二、MSDN 函数搜索 函数的介绍 关于get

qq_47799626的博客 5616

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

【免费下载】 C语言库函数查询手册资源下载

C语言库函数查询手册资源下载 【下载地址】C语言库函数查询手册资源下载 本仓库提供了一个C语言库函数查询手册的资源文件下载,文件名为 `C语言库函数查询手册.chm`。该资源文件是一个压缩包,内含以下六个CHM格式的手册:1. **C参考手册.chm** - 最全面的一个手册,涵盖了C语言的各个方面。2. **C函数查询...

gitblog_09819的博客 1485

c语言中min函数的作用,C语言库函数

C语言库函数是把自定义函数放到库里,是别人把一些常用到的函数编完放到一个文件里,供程序员使用。程序员用的时候把它所在的文件名用#include<>加到里面就可以了(尖括号内填写文件名),例如#include。中文名C语言库函数C语言库函数定义编辑一般是指编译器提供的可在c源程序中调用的函数。可分为两类,一类是c语言标准规定的库函数,一类是编译器特定的库函数。由于版权原因,库函数的源代码...

weixin_39680678的博客 3022

查看C语言库函数源码

C语言库函数源码哪里看?这里看!

火红色祥云 5575

c语言函数库入门,C语言库函数

C语言库函数是把自定义函数放到库里,是别人把一些常用到的函数编完放到一个文件里,供程序员使用。程序员用的时候把它所在的文件名用#include<>加到里面就可以了(尖括号内填写文件名),例如#include。中文名C语言库函数C语言库函数定义编辑一般是指编译器提供的可在c源程序中调用的函数。可分为两类,一类是c语言标准规定的库函数,一类是编译器特定的库函数。由于版权原因,库函数的源代码...

weixin_30420799的博客 1089

C语言库函数大全

<br />C语言库函数手册分类函数,所在函数库为 ctype.hint isalpha(int ch)  若ch是字母('A'-'Z','a'-'z')返回非0值,否则返回0int isalnum(int ch)  若ch是字母('A'-'Z','a'-'z')或数字('0'-'9')                     返回非0值,否则返回0int isascii(int ch)  若ch是字符(ASCII码中的0-127)返回非0值,否则返回0int iscntrl(int ch)  若ch是作废

代码狂 1万+
上一篇: C语言库函数(五)
下一篇: C语言库函数(七)
liu0013
博客等级 码龄22年 5粉丝 14原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值