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

GlobalMapper地形对比与方量计算实战:从两期数据到填挖方区域精准提取

本文详细介绍了使用GlobalMapper进行地形对比与方量计算的实战方法,从两期数据准备到填挖方区域精准提取。通过三步核心操作和实用技巧,帮助工程师高效完成土方平衡分析,提升工程预算精度。特别适用于河道整治、湿地修复等工程项目,大幅减少人工计算误差和时间成本。

weixin_28698059的博客 221

数字语音处理——用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

SAP ABAP BADI_FINS_ACDOC_POSTING_EVENTS 深度应用:KO88工单结算的凭证字段定制与财务数据增强

本文深入探讨了SAP ABAP中BADI_FINS_ACDOC_POSTING_EVENTS在KO88工单结算中的应用,详细解析了如何通过BADI实现财务凭证字段的定制与数据增强。文章提供了从结构扩展到BADI方法实现的完整步骤,包括性能优化建议和实际应用中的测试验证流程,帮助开发人员高效解决企业个性化财务需求。

weixin_26869081的博客 391

在 dell precision 7920 tower CentOS 8 Stream 上安裝nvidia驱动程序、Anaconda

简单记录一下如何在实验室dell precision 7920 tower CentOS 8 Stream上安装nvidia显卡驱动。

chen9046的博客 995

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

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

诚朴勇毅 3664

Windows下PaddleOCR GPU版环境搭建全攻略(含CUDA 11.7避坑指南)

本文提供了一份详尽的Windows平台PaddleOCR GPU版环境搭建指南,重点涵盖CUDA 11.7与cuDNN的版本匹配、环境变量配置及常见避坑方法。通过使用Conda创建虚拟环境并安装匹配的PaddlePaddle-gpu版本,最终实现GPU加速的OCR推理,帮助开发者构建稳定高效的开发环境。

docker7nomad的博客 751

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

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

weixin_34280237的博客 3687

5nm制程的CV5芯片实测:用它给无人机做8K拍摄和实时避障,功耗和性能到底怎么样?

本文深度评测了5nm制程的CV5芯片在无人机8K拍摄和实时避障中的表现。通过实测数据展示了CV5的异构计算架构、8K视频编码性能和CVflow®AI引擎的加速效果,同时提供了开发中的优化技巧和散热建议,为无人机开发者提供了实用的参考。

weixin_30861797的博客 358

akshare 布林通道策略

import datetime import pandas as pd import backtrader as bt import matplotlib.pyplot as plt from datetime import datetime import matplotlib import akshare as ak %matplotlib inline class Boll_strategy(bt.Strategy): #自定义参数,每次买入1800手 params=(('size'.

qq_26742269的博客 5343

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

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

weixin_34405354的博客 159

【NIPS 2022】时序精选论文07|Non-stationary Transformers: 引入非平稳性信息的平稳化序列预测模型(代码解读附源码)

整体代码框架基本上与传统 Transformer 类似,基本上只有在内嵌的注意力机制模块有区别,因此这里只对关键部分进行讲解,代码整体框架可参考 Transformer。非平稳时序很难预测,尤其对模型泛化性影响很大,试想下推理阶段的数据分布变了,模型很难适应这种变化。,比如很早以前的差分就是一种平稳化操作。序列平稳化能增强数据的可预测性,但这时也会带来一个问题,叫。,通过MLP层进行定义,使得参数可学习,以便于更好的融合到注意力网络中。代码中整体注意力的计算方式与原生Transformer类似,

ViolenceTemper的博客 1495

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

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

qq_74009838的博客 1万+

【通信协议】GATT 与 BLE HID 工作原理详解

详细介绍BLE HID 跟GATT工作原理与两者的交互关系

以实战经验介绍行业知识 844

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

C语言库函数

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

weixin_55608863的博客 2328

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

C语言库函数查找工具MSDN

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

qq_47799626的博客 5616

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

【免费下载】 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、付费专栏及课程。

余额充值