拼图游戏(c语言)

这个拼图游戏是大一时的c语言课程设计: 说明: 游戏说明: 一、游戏难度: l--------------------------简单; m--------------------------一般; h--------------------------困难; 二、游戏玩法 按“↑”、“↓”、“←”、“→”使方块移动; 当结果为下列情况是获胜: 1、 1 2 3 4 5 6 7 8 2、 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3、 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...

作者: himdd 发布时间: 01-04

Netfilter源码分析--7、内核空间与用户空间的数据交互

七、内核空间与用户空间的数据交互 内核空间与用户空间的数据交互通过getsockopt和setsockopt来完成,这个两个函数用来控制相关socket文件描述符的的选项值,先来看这两个函数的原型: set/getsockopt(2)函数的基本使用格式为: int setsockopt(int sockfd, int proto, int cmd, void *data, int datalen) int getsockopt(int sockfd, int proto, int cmd, void *data, int d...

作者: jazy333 发布时间: 01-05

实例解读网卡驱动

Tg3 Gbit NIC Driver Analysis 在此仅仅讨论网络设备驱动的一般写法,有关硬件部分的相关代码由于硬件规格不同,予以省略。有什么地方错误,或补充,欢迎大家提出。 1, 驱动模块的加载和卸载 如果网络设备(包括wireless)是PCI规范的,则先是向内核注册该PCI设备(pci_register_driver),然后由pci_driver数据结构中的probe函数指针所指向的侦测函数来初始化该PCI设备,并且...

作者: 空灵静世 发布时间: 01-04

CentOS 修改ls目录的颜色

修改ls目录的颜色 linux系统默认目录颜色是蓝色的,在黑背景下看不清楚,可以通过以下2种方法修改ls查看的颜色 方法一: 1、在~/.bash_profile文件中添加LS_COLORS export LS_COLORS='no=00:fi=00:di=01;33:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;35:*.cmd=01;35:*.exe=01;35:*.com=01;35:*.btm=01;35:*.bat=01;35:*.sh=...

作者: x-fish 发布时间: 01-05

c#父子窗体间的自定义事件(static)

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace ppop_client { public partial class MDI : Form { private int childFormNumber = 0; public MDI() { InitializeComponent(); } private void ShowNewForm(object sender, EventArgs e...

作者: cexoyq 发布时间: 01-05

编译内核模块 .ko文件的注意事项 缺少:mmzone.h..

前两天新到手一个6410的板子,按照说明在上面跑了一下android和QT,都成了。今天想试试helloworld模块的装载发现了一些需要注意的问题。 出现的问题:编译的时候提示缺少头文件 mmzone.h ....bounds.h...等 include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory include/linux/mmzone.h:197:5: warning: "MAX_NR_ZONES" is not defined 原因:b...

作者: pauleric 发布时间: 01-06

dynamic_cast 操作符

我觉得c++提供的四个强制类型转换操作符中最有意思的就要数dynamic_cast,其他三个非常简单,不作赘述! dynamic_cast 将基类类型的指针或引用转换为同一继承层次中其他类型的引用或指针,与其他的强制类型转换不同的是,dynamic_cast涉及运行时类型检查,如果绑定到引用或指针的对象不是目标类型的对象,则dynamic_cast失败,如果转换指针类型的dynamic_cast失败,则dynami...

作者: dmastery 发布时间: 01-05

container_of()宏的简要解析[转载!!!]

作者: 和c/c++相关 2010/11/16 简介:这是container_of()宏的简要解析的详细页面,介绍了和c/c++,有关的知识、技巧、经验,和一些c/c++源码等。 在学习linux驱动的过程中,遇到一个宏叫做container_of。 该宏定义在include/linux/kernel.h中,首先来贴出它的代码: 1. 439/** 2. 440 * container_of - cast a member of a structure out to the containing structure 3. 44...

作者: lxp-linux 发布时间: 01-06

利用Apache的deflate模块压缩HTTP传输量

为了节约带宽,减少网络传输量,加快网速,我们决定对网页进行压缩后再传输给客户. 可以选择gzip或者gzip来压缩. 我们的服务器软件是Apache 2.2.3 / CentOS 5 Apache2.x版本自带了deflate模块,我们可以直接使用(Apache 1.x 使用 modgzip). 配置: vim /etc/httpd/conf/httpd.conf /mod_deflate 查找 应该能找到 LoadModule deflate_module modules/mod_deflate.so 如果前面有#注...

作者: realmon 发布时间: 01-04

位图排序

位图排序: 任意个(MAX_NUMBERS个) 0到固定值(MAX_VALUE)之间的数排序 时间复杂度O(n), 空间几乎是O(1),空间需求很低 假定int的长度是32位,即一个int可以编码32个数字(简单起见,一个bit代表一个数字,实际可以编码的范围就是unsigned int的最大值,但计算比较复杂), 那么0到n之间的数字就可以用最多n/32+1个整形表示,每个int的每个bit代表一个数。。 #include <stdio...

作者: donotblock 发布时间: 01-06