tftpd32 工具中的 dhcp tftp 使用说明

1.下载 tftpd32 工具 下载 http://download.csdn.net/detail/chinaeran/9445298(tftpd32_v4.5.2绿色版.zip) 2.解压运行 3.DHCP服务器配置 例如分配10段的网络 4.tftp服务器配置 设置好路径和ip即可……

阅读全文

SecureCRT 配置 - Linux终端、颜色、透明效果

概览 SecureCRT 安装好后,白底黑字,不透明,ls 没颜色,看起来相当不爽 先看下配置好后的效果吧 :-) 1.设置终端主题,黑底白字 选全局配置 默认会话 颜色主题和字符编码 保存 2.设置字符颜色和终端类型 选择 Linux,勾选 ANSI Color 3.设置透明效果 数值越小越透明……

阅读全文

文本编辑器/16进制编辑器 MadEdit 推荐

概览 平时经常会查看16进制文件,有用 UltraEdit、NotePad++ 的,但是一直使用 MadEdit,简单、轻快、绿色,用起来很爽,所以才会有这篇文章。 我使用的是 MadEdit-Mod (MadEidt 的作者好像是国人,已经不更新了,MadEdit-Mod 修复了一些 bug,添加了一些新的功能), 下载地址:https:……

阅读全文

Linux fork 后 wait 获取子进程结束的状态示例

概览 使用 fork 后,可能需要获取 fork 的进程的运行状况,比如有没有异常、崩溃。 wait 在 man 中关键的描述如下: All of these system calls are used to wait for state changes in a child of the calling process, and obtain information about the child whose state has changed. A state change is considered to be: the child terminated; the child was stopped by a signal; or the child was resumed by a signal. 示例代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46……

阅读全文

Linux 最简单内核模块 Hello World 示例

注: 如果想要按照本篇实践,需要有能运行的arm开发板和对应版本的内核(如果想在Linux主机上编译运行,请参考附1) 1.在相应版本内核的driver目录下新建如下文件 其中文件代码如下: /* hello.c */ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #include <linux/init.h>#include <linux/module.h> static int hello_init(void) { printk(KERN_INFO "[init] Can you feel me?\n"); return 0; } static void hello_exit(void) { printk(KERN_INFO "[exit] Yes.\n"); } module_init(hello_init); module_exit(hello_exit); MODULE_AUTHOR("Alan Wang <alan@wrcode.com>"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("A simple Hello……

阅读全文

阅读 | 写在200小时

上一次多看阅读时长到100小时是14年的10月份,现在到了200小时了,因为我读书有个非常不好的习惯,遇到喜欢的书,一般会很快读完,导致很容易忘记都读过什么书和其中的内容,因此记录一下,也希望自己以后能读的慢一些。 有人说(有人是谁?),对于一本好书,读完是第一步,思考是第二步,实践是第三步,这三步都……

阅读全文

C语言结构体初始化的三种方法

示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 #include <stdio.h> struct student_st { char c; int score; const char *name; }; static void show_student(struct student_st *stu) { printf("c = %c, score = %d, name = %s\n", stu->c, stu->score, stu->name); } int main(void) { // method 1: 按照成员声明的顺序初始化 struct student_st s1 = {'A', 91, "Alan"}; show_student(&s1); // method 2: 指定初始化,成员顺序可以不定,Linux 内核多采用此方式 struct student_st s2 = { .name = "YunYun", .c = 'B', .score = 92, }; show_student(&s2); // method 3:……

阅读全文

C语言计算日期间隔天数的经典算法解析

概览 在网上看到了一个计算日期间隔的方法,咋一看很高深,仔细看更高神,很巧妙。 先直接代码吧 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include <stdio.h>#include <stdlib.h> int day_diff(int year_start, int month_start, int day_start , int year_end, int month_end, int day_end) { int y2, m2, d2; int y1, m1, d1; m1 = (month_start + 9) % 12; y1 = year_start - m1/10; d1 = 365*y1 + y1/4 - y1/100 + y1/400 + (m1*306 + 5)/10 + (day_start - 1); m2 = (month_end + 9) % 12; y2 = year_end - m2/10; d2 = 365*y2 + y2/4 - y2/100 + y2/400 + (m2*306 +……

阅读全文

Linux C ftruncate 函数清空文件注意事项(要使用 lseek 重置偏移量)

概览 之前有个要把打开的文件清空,然后重新写入的需求,但是使用 ftruncate(fd, 0)后,并没有达到效果,反而文件头部有了'\0',长度比预想的大了。 究其原因是没有使用 lseek 重置文件偏移量,是我太天真了,以为清空文件就会从头开始写入。 文档 首先 man ftruncate 看下帮助手册 1 2 3 4 5 6 7 8 9 10 11 12 13 14 NAME truncate, ftruncate - truncate a file to a specified length SYNOPSIS int truncate(const char *path, off_t length); int……

阅读全文

gcc/g++/make 编译信息带颜色输出

概览 如果编译一个项目错误警告太多,非常不好找,所以非常希望输出信息可以带有颜色。 可是 gcc 4.9.0 之前的版本并不支持,很多情况下是不能替换编译器的,比如使用交叉编译器, 也可以使用 colorgcc,但我觉得不是特别好,需要配置,如果使用 Makefile 还要更改编译器设置, 所以我自己动手写了一个,效果还可以,源码在github……

阅读全文

最近文章

分类

标签

其它