自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(5)
  • 收藏
  • 关注

原创 函数指针作为函数参数 定义、使用、调用简例

//函数定义char *info_1(int wp, char *ctx){//功能实现,省略}char *info_2(int wp, char *ctx){//功能实现,省略}//函数指针作为函数参数char *info(int wp, char *ctx, char *(*cb)(int, char *)){ char *result = NULL; //使用 result = cb(wp, ctx);}//调用函数int all_1(){ info(wp,

2021-05-11 10:58:32 474

原创 C语言字符串修改、替换部分字符串

#include <stdio.h>#include <string.h>char *strpl(char *str, char *old, char *new){ char *p = NULL; int len = 0; char newstr[64] = {0}; p = strstr(str,old); len = p - str; strncpy(newstr, str, len); strcat(newstr, new); strcat(news

2021-05-08 14:30:02 12523 2

原创 使用fgets()函数读取系统文件 第n次读第n行

fgets()函数每次只获取一行,并且第一次只获取文本第一行,第二次获取时会忽略第一行,获取文本第二行,第n次调用函数获取第n行#include <string.h>#include <stdio.h>int main(){ FILE *fp = NULL; char buf[64] = {0}; int i; fp = fopen("/proc/meminfo", "r");// cat /proc/meminfo if (fp == NULL)

2020-12-01 17:33:45 1510

原创 C语言获取CPU使用率(Linux 64位)

#include <string.h>#include <stdio.h>int main(){ FILE *fp; char buf[128]; char cpu[5]; long int user, nice, sys, idle, iowait, irq, softirq; long int all1, all2, idle1, idle2; float usage; //CPU Occupancy rate fp =

2020-11-23 15:31:23 2354 1

原创 iptables扩展之icmp扩展(REJECT)

#iptables -p icmp -hicmp match options:以下部分就是相关介绍,iptables命令包含ICMP类型代码表的部分;命令规则iptables [-t table] COMMAND [chain] CRETIRIA -j ACTIONACTION,操作动作有三种(DROP,ACCEPT,REJECT)查看REJECT相关,命令#iptables -j REJECT -hREJECT target options: 以下部分就是相关介绍Reject的动作后面可以接

2020-10-19 10:04:39 1793

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除