会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
东宫得臣
博客园
首页
新随笔
联系
订阅
管理
2024年1月25日
域名转换成IP地址
摘要: #include <string.h> #include <errno.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #define MAXLINE 1024 i
阅读全文
posted @ 2024-01-25 15:21 东宫得臣
阅读(42)
评论(0)
推荐(0)
2024年1月23日
十六进制转换为点分十进制IP格式
摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <arpa/inet.h> #define MAXBUF 1024 int main(int argc, char **arg
阅读全文
posted @ 2024-01-23 16:52 东宫得臣
阅读(66)
评论(0)
推荐(0)
2024年1月16日
将一个数组中的元素头尾两端对调
摘要: #include <stdio.h> void inplace_swap(int *x, int *y) { printf(" \n"); printf("x = %d, y = %d\n", *x, *y); *y = *x ^ *y; printf("x = %d, y = %d\n", *x,
阅读全文
posted @ 2024-01-16 18:40 东宫得臣
阅读(17)
评论(0)
推荐(0)
十进制转为十六进制
摘要: #include <stdio.h> #include <stack> int main() { std::stack<char> s; int num, mod; printf("输入十进制数: \n"); scanf("%d", &num); printf("num: %d\n", num);
阅读全文
posted @ 2024-01-16 11:47 东宫得臣
阅读(91)
评论(0)
推荐(0)
2023年4月23日
linux 的touch命令
摘要: 之前一直以为,touch命令的原本意图是创建文件,这也是我们运行touch的大部分场景。 今天,看到了官方手册页的描述,touch - change file timestamps,刷新了认知。 原来touch是修改文件的时间戳的。 Update the access and modificatio
阅读全文
posted @ 2023-04-23 17:06 东宫得臣
阅读(26)
评论(0)
推荐(0)
2023年4月6日
udp协议的获取时间的客户端
摘要: #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> c
阅读全文
posted @ 2023-04-06 22:47 东宫得臣
阅读(26)
评论(0)
推荐(0)
udp协议的时间服务器
摘要: #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <string.h> #
阅读全文
posted @ 2023-04-06 22:44 东宫得臣
阅读(40)
评论(0)
推荐(0)
2022年10月14日
计数器和信号量都在共享内存区中
摘要: #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <semaphore.h> #include <stdlib.h> #include <sys/mman.h> const in
阅读全文
posted @ 2022-10-14 16:47 东宫得臣
阅读(18)
评论(0)
推荐(0)
2022年10月13日
在内存映射文件中给计数器+1
摘要: #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <semaphore.h> #include <stdlib.h> #include <sys/mman.h> #define
阅读全文
posted @ 2022-10-13 13:46 东宫得臣
阅读(20)
评论(0)
推荐(0)
2022年10月12日
多个生产者,单个消费者,信号量
摘要: #include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <pthread.h> #include <semaphore.h> #define min(a,b) ((a)<(b)?(a):(b)) #define NBUFF
阅读全文
posted @ 2022-10-12 15:03 东宫得臣
阅读(24)
评论(0)
推荐(0)
下一页