zoukankan      html  css  js  c++  java
  • 记录一些Linux C的常用库函数

    我已经受不了每次用的时候去百度了,还百度不出来。。。。。

    【数字字符串转换篇】

    atof - convert a string to a double

    #include <stdlib.h>

    double atof(const char *nptr);

    atoi, atol, atoll, atoq - convert a string to an integer

    #include <stdlib.h>

    int atoi(const char *nptr);
    long atol(const char *nptr);
    long long atoll(const char *nptr);
    long long atoq(const char *nptr);

    strtod, strtof, strtold - convert ASCII string to floating-point number

    #include <stdlib.h>

    double strtod(const char *nptr, char **endptr);
    float strtof(const char *nptr, char **endptr);
    long double strtold(const char *nptr, char **endptr);

    strtoul, strtoull, strtouq - convert a string to an unsigned long integer

    #include <stdlib.h>

    unsigned long int strtoul(const char *nptr, char **endptr, int base);

    unsigned long long int strtoull(const char *nptr, char **endptr, int base);

    gcvt - convert a floating-point number to a string

    #include <stdlib.h>

    char *gcvt(double number, size_t ndigit, char *buf);

    【字符串操作篇】

    strtok, strtok_r - extract tokens from strings

    #include <string.h>

    char *strtok(char *str, const char *delim);

    char *strtok_r(char *str, const char *delim, char **saveptr);

    strcmp, strncmp - compare two strings

    #include <string.h>

    int strcmp(const char *s1, const char *s2);

    int strncmp(const char *s1, const char *s2, size_t n);

    strcasecmp, strncasecmp - compare two strings ignoring case

    #include <strings.h>

    int strcasecmp(const char *s1, const char *s2);

    int strncasecmp(const char *s1, const char *s2, size_t n);

    【网络字节篇】

    htonl, htons, ntohl, ntohs - convert values between host and network byte order

    #include <arpa/inet.h>

    uint32_t htonl(uint32_t hostlong);

    uint16_t htons(uint16_t hostshort);

    uint32_t ntohl(uint32_t netlong);

    uint16_t ntohs(uint16_t netshort);

    【输出篇】

    printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatted output conversion

    #include <stdio.h>

    int printf(const char *format, ...);
    int fprintf(FILE *stream, const char *format, ...);
    int sprintf(char *str, const char *format, ...);
    int snprintf(char *str, size_t size, const char *format, ...);

    #include <stdarg.h>

    int vprintf(const char *format, va_list ap);
    int vfprintf(FILE *stream, const char *format, va_list ap);
    int vsprintf(char *str, const char *format, va_list ap);
    int vsnprintf(char *str, size_t size, const char *format, va_list ap);

  • 相关阅读:
    Spring Boot学习笔记
    打造高效率的软件测试
    如何将测试结果在jenkins上发布
    如何在docker container中运行web自动化测试
    Jmeter中随机读取测试文件的内容
    如何提高UI自动化测试的质量
    mac系统上添加定时任务
    keypass口令管理实践
    GPG实践
    树的遍历
  • 原文地址:https://www.cnblogs.com/jieyuefeng/p/3424897.html
Copyright © 2011-2022 走看看