C
文章平均质量分 76
guozan523
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
lex
代码:main.c instructions.c error_report.c analyze.cinstructions.h error_report.h analyze.hmain.c#include #include #include #include "analyze.h"#include "instructions.h"int main(int原创 2009-10-20 12:57:00 · 651 阅读 · 0 评论 -
linux内核模块编译,最简单的hello world
驱动源代码可用,只是MODULE_LICENCE行老报错,加上#也不行,就注释掉了//hello world driver for linux 2.6#include #include #include //MODULE_LICENCE("GPL");static int __init hello_init(void){ printk(KERN_ALERT "Hello, world! from kernel space..../n"); return 0;}原创 2011-01-22 21:21:00 · 1526 阅读 · 1 评论 -
小激动,代码恁帅了——最长公共子序列
<br />/*commom subsequenceuse an array of two rows******************just like thiseach time in turn, because the length of a[i][j] is only defined by a[i-1][j-1]or a[i][j-1] a[i-1][j], so we only need two rowsm[i] == n[j] -> a[i][j] = a[i-1原创 2010-11-26 22:44:00 · 624 阅读 · 0 评论 -
struct 中部分变量赋值
<br />C 语言中对struct中部分变量命名,见到变量名中带 . 不要惊讶——C变量名是不允许有 . 的<br /> <br /> <br /> <br /> #include <stdio.h>int main(int argc, char *argv[]){ struct s { int a; int b; int c; }; struct s test = { .b =原创 2011-01-15 19:16:00 · 1868 阅读 · 0 评论 -
指向函数的指针,重温大一的C知识
<br /><br />//今天看了个tftp的源码,为下面的typedef纠结,还好经过一段时间研究,终于看懂了。下面是学到的东西<br /> <br />//首先说明(* CMDFUNC)(char [][256],int pcount)是void,可猜测CMDFUNC是什么,下面会有揭晓<br />typedef void (* CMDFUNC)(char [][256],int pcount);<br /> <br />//定义CMDNUM类型<br />typedef struct _cmdnum原创 2010-11-16 22:57:00 · 811 阅读 · 0 评论 -
grep –v usr result.txt
<br />/* Filename: go.c Author: guozan @SCS-BUPT Mail: guozan523@gmail.com Date: 2010/5/7 Desciptions: program to complete grep –v usr < /etc/passwd | wc –l > result.txt More:*/#include <unistd.h>#in原创 2010-08-05 20:29:00 · 1246 阅读 · 0 评论 -
ls v0.2
/* Filename: list.c Author: guozan @SCS-BUPT Mail: guozan523@gmail.com Date: 2010/4/6 Desciptions: a program similar with linuxs ls, with -a : list all, include ones with . infront原创 2010-04-07 09:37:00 · 1496 阅读 · 0 评论 -
ls的C语言实现
/* Name: list.c Author: guozan _SCS_BUPT Mail: guozan523@foxmail.com Date: 2010/4/6 实验目的:练习vi,使用UNIX的系统调用和库函数,体会UNIX文件通配符的处理方式以及命令对选项的处理方式。 编程实现程序list.c,列表普通磁盘文件(不考虑目录和设备原创 2010-04-06 23:30:00 · 6811 阅读 · 0 评论 -
selective repeat
和网络层/物理层的接口是由库函数提供,所以只是把数据链路层对包的处理贴上 /* file: datalink.c *//* use: complete protocol 6, the selective repeat *//* date: 2009 11 22 11:55:21 CST *原创 2009-12-02 19:45:00 · 3100 阅读 · 1 评论 -
Linux内核container_of宏
container_of宏是Linux内核中经常出现的一个东西,原型定义在linux/include/linux/kernel.h中#define container_of(ptr, type, member) ({ / const typeof( ((type *)0)->member ) *__mptr = (ptr); / (type *)( (char *)__mptr - offsetof(type,member) );})ptr指向type(目前发现都是struct 类型)中的一个元素m原创 2011-02-12 21:09:00 · 1046 阅读 · 0 评论
分享