- 博客(84)
- 资源 (7)
- 收藏
- 关注
原创 详细解析Linux目录结构
http://tech.ccidnet.com/art/738/20100716/2118509_1.html Linux目录结构是和windows有大不同的设计,这很容易让初学者搞不明白,这里是个人总结的一些知识点,讲解Linux目录结构包括文件类型和一些重要的文件子目录。 linux文件系统的最顶端是/,称为linux的root,所有的目录、文件、设备都在/之下。 ...
2010-09-29 10:59:18
234
原创 安装交叉编译工具 遇到的问题
1. 不要在/usr/local/arm/目录下解压缩cross-3.4.1.tar.bz2如果在 /usr/local/arm/目录下解压缩,那么解压缩后的路径会是/usr/local/arm/usr/local/arm/3.4.1/ 2.安装好后 要在/etc/bashrc 文件最后一行,添加环境变量 PATH 3. 修改环境变量后,arm-linux-gcc后 还是 co...
2010-08-08 15:56:37
315
原创 BootLoader简介
http://baike.baidu.com/view/1223454.htm?fr=ala0_1在专用的嵌入式板子运行GNU/Linux系统已经变得越来越流行。一个嵌入式Linux系统从软件的角度看通常可以分为四个层次: 1、 引导加载程序。包括固化在固件(firmware)中的boot代码(可选),和BootLoader两大部分。 2、 Linux内核。特定于嵌入式板子的定...
2010-08-02 14:33:29
295
原创 VMware5.5.3下安装RedHat9与windows共享文件
http://ninayang1987.blog.sohu.com/135196709.html 下面把步骤贴出来,以供分享。 1. 利用VMware工具中的共享文件夹功能实现文件供享;1) 启动PC中的VMware;2) 在VMware窗口中选择“虚拟机(M)”下拉菜单;在菜单中选择“按装VMware工具(V)”;3) 开启一个终端窗口,准备键入命令;4) ...
2010-08-01 19:08:50
420
原创 C程序 声明与定义的区别
http://zhidao.baidu.com/question/144340465.html?fr=ala0 如果是指变量的声明和定义:从编译原理上来说,声明是仅仅告诉编译器,有个某类型的变量会被使用,但是编译器并不会为它分配任何内存。而定义就是分配了内存。对于下面的两句代码:void Func(){int a;int b=0;a=0;}对于第一行代码,编译器不会做任何事,它不会为它在栈...
2010-07-30 15:34:36
321
原创 C语言 函数指针 与 指针函数
指针函数是返回指针的函数,即本质是一个函数。函数返回类型是某一类型的指针例如:int *f(x,y);函数指针是指向函数的指针变量,即本质是一个指针变量。例如: int (*f) (int x); /* 声明一个函数指针 */ f=func; /* 将func函数的首地址赋给指针f */ 分析复杂的声明: char (*a[3])(int); ...
2010-07-30 10:27:57
151
原创 C程序 命令行参数
echo.cpp #include <stdio.h>/* echo command-line arguments; 1st version */main(int argc, char *argv[]){ int i; for (i = 1; i < argc; i++) printf("%s%s", argv[i], (i < argc...
2010-07-30 09:34:05
191
原创 C程序 整型数按位取反 输出结果
#include <stdio.h>int main(){ int i = 2; int j=~i; printf("%d\n",j); return 0;}// 输出结果为-3 在计算机里数据以补码的形式存放,2的源码是 0010,其补码是0010,取反后为1101,输出时,计算机认为1101是一个负数,因此,既是一个求补码的原码的过程。一个数的补码是...
2010-07-29 15:16:10
851
原创 C程序 对文本行进行排序
#include <stdio.h>#include <string.h>#include <stdlib.h> #define MAXLINES 5000 /* max #lines to be sorted */char *lineptr[MAXLINES]; /* pointers to text lines */in...
2010-07-26 09:30:30
345
原创 C语言:malloc()函数与alloc()函数
C语言跟内存分配方式 (1) 从静态存储区域分配。内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在。例如全局变量,static变量。 (2) 在栈上创建。在执行函数时,函数内局部变量的存储单元都可以在栈上创建,函数执行结束时这些存储单元自动被释放。栈内存分配运算内置于处理器的指令集中,效率很高,但是分配的内存容量有限。 (3)从堆上分配,亦称动态内存分配。程序...
2010-07-24 10:02:14
207
原创 C程序设计语言(第二版) 5-4 strend(s,t)
strend(s,t) 如果字符串t出现在字符串s的尾部,该函数返回0,否则返回1 #include<stdio.h>int strend(char *s,char *t);int main(){ char *s="hewawowa"; char *t="wo"; int cmp=strend(s,t); printf("%d\n...
2010-07-23 16:29:42
415
原创 C程序设计语言(第二版) 5-3 编写strcat()
#include<stdio.h>void strcat(char *s, char *t);void strcpy(char *s,char *t);int main(){ char s[100] = "hello"; char *d = "world"; strcat(s,d); printf("%s\n",s); retu...
2010-07-23 16:02:56
235
原创 C程序 关于字符串的问题
#include<stdio.h>void strcpy(char *s,char *t);int main(){ char *s = new char[100]; s = "hello"; //char s[100] = "hello"; char *d = "world"; strcpy(s,d); printf("%s\...
2010-07-23 15:47:24
221
原创 C程序设计语言(第二版)5-2
#include <ctype.h>#include <stdio.h>#define BUFSIZE 100char buf[BUFSIZE]; /* buffer for ungetch */int bufp = 0; /* next free position in buf */int getch(void);void...
2010-07-22 17:13:44
284
原创 C程序设计语言(第二版) 4-14
定义宏swap(t, x, y)以交换t类型的两个参数 #include<stdio.h>#define swap(t,x,y) do{t z=x;x=y;y=z;}while(0) int main(void) { int ix, iy; double dx, dy; char *px, *py; ix = 42; iy = 6...
2010-07-22 11:47:59
289
原创 C程序设计语言(第二版) 4-13 递归版本reverse()将字符串倒置输出
编写一个递归版本的reverse()函数,将字符串倒置 #include<stdio.h>void reverse(char *s);int main(){ char *s ="hello"; reverse(s); return 0;}void reverse(char *s){ char line =*s; if(line){...
2010-07-22 11:18:24
489
1
原创 C程序设计语言(第二版) 4-12
运用printd函数的设计思想编写一个递归版本的itoa函数,即通过递归调用把整数转换为字符串 #include <stdlib.h> #include <stdio.h> /*思路:先调用itoa,在itoa中判断int型value是正还是负,无论正负,将value转换成unsigned型,然后调用utoa*/char *utoa(unsigned...
2010-07-22 10:29:06
278
原创 C程序 递归小例子 快速排序
从执行速度来讲,下列版本的快速排序可能不是最快的,但是它是最简单的算法之一。在每次划分子集时,该算法总是选取各个子数组的中间元素,(作为划分子集的基准)。 /* qsort: 以递增顺序对v[left]...v[right]进行排序 */ void qsort(int v[], int left, int right) { int i, last; ...
2010-07-22 09:26:54
199
原创 C程序 递归实现将数字作为字符串输出
将一个数字作为字符串打印的情况,数字是反序生成的:低位数字先于高位数字生成,但他们必须以与此相反的次序打印。解决该问题有两种方法,一种是将生成的各个数字依次存储在字符数组中,然后再以相反的次序打印,这种方式与3.6中的itoa函数的处理方式相似。 另一种方法则是使用递归:#include<stdio.h>void printd(int n){ if(n&...
2010-07-21 15:47:13
417
原创 C语言学习之变量存储
http://zhidao.baidu.com/question/42163882.html?fr=ala0 C语言中对变量的说明包括两方面的内容:变量类型以及变量的存储类型。变量类型如:int(整形),char(字符型)是用来说明变量所占用的内存空间的大小。变量存储类型用来说明变量的作用范围。C语言的变量存储类有:自动类、寄存器类、静态类和外部类。关键字auto加在变量名及其类型前,用来...
2010-07-21 15:14:52
242
原创 C语言外部变量的使用以及extern的用法
http://hi.baidu.com/%C3%E2%B7%D1%B4%F3%BB%B0%D0%F2%C1%D0%BA%C5/blog/item/e3b2e4cb4f2be1f453664f06.html 对外部变量的说明和定义不是一回事.对外部变量的说明,只是声明该变量是在外部定义过的一个全局变量..在这里引用.而对外部变量的定义,则是要分配存储单元.一个全局变量只能定义一次,却可...
2010-07-21 15:11:11
1491
原创 C语言 全局变量和局部变量
http://hi.baidu.com/%C3%E2%B7%D1%B4%F3%BB%B0%D0%F2%C1%D0%BA%C5/blog/item/2d559ddc8f07e2a8cd11661d.html 变量可以在程序中三个地方说明: 函数内部、函数的参数定义中或所有的函数外部。根据所定义位置的不同, 变量可分为局部变量、形式参数和全程变量。从空间角度来看,变量可以分为全局变量和局部变量...
2010-07-21 15:07:41
199
原创 C语言 extern
在头文件中声明函数时,前面的extern可有可无,只要这些函数曾在某个.c文件中实现就行了,不过一些函数没有在所包含的头文件中给出声明,同时函数的定义位于其它文件中,这时候使用该函数的.c文件必须用extern标记该函数为外部函数。举个例子: /* c.h */extern int max(int a, int b);extern int min(int a, int b);...
2010-07-21 11:20:49
161
原创 C程序设计语言(第二版) 4-8 最多只压回 一个字符
#include <stdio.h> int buf = EOF; /* buffer for ungetch */ int getch(void) /* get a (possibly pushed back) character */ { int temp; if (buf != EOF) { temp = buf; buf...
2010-07-20 18:47:58
245
原创 C程序设计语言(第二版) 4-7 编写一个函数ungets(),将整个字符串压回到输入中...
#include<stdio.h>#include<string.h> #define BUFSIZE 100 char buf[BUFSIZE]; int bufp = 0; int getch(void); void unGetch(int);/* Getch: get a ( possibly pushed back) ...
2010-07-20 18:38:16
531
原创 C程序设计语言(第二版) 4-6
#include<stdlib.h> #include<stdio.h> #include<ctype.h> #include<math.h> #include<string.h> #define MAXOP 100 #define TRUE 1 #define FALSE 0 #define ...
2010-07-20 18:15:13
254
原创 C程序设计语言(第二版) 4-5 给计算器添加访问sin、exp与pow等库函数的操作
#include<stdlib.h> #include<stdio.h> #include<ctype.h> #include<math.h> #include<string.h> #define MAXOP 100 #define TRUE 1 #define FALSE 0 #define ...
2010-07-20 17:32:55
653
原创 C程序设计语言(第二版) 4-4 栈操作添加复制、打印栈顶元素,交换栈顶元素等...
#include<stdlib.h> #include<stdio.h> #include<ctype.h> #include<math.h> #define MAXOP 100 #define NUMBER 0 #define TRUE 1 #define FALSE 0 int Getop(char s...
2010-07-20 16:59:27
397
1
原创 C程序设计语言(第二版) 4-3 逆波兰计算器
在该程序中加入了取模(%)运算符,并对负数进行处理 #include <stdio.h>#include <stdlib.h> /* for atof() */#include <ctype.h> #define MAXOP 100 /* max size of operand or operator */#define...
2010-07-20 16:15:14
258
原创 C程序设计语言(第二版) 4-2
4-2 对atof函数进行扩充,使它可以处理123.45e-6的科学表示法。其中,浮点数后面可能会紧跟一个e或者E以及一个指数(可能有正负号) #include <ctype.h> #include <stdio.h>#define MAXLINE 100int getline(char line[], int max);double a...
2010-07-19 16:01:39
224
原创 C程序设计语言(第二版) 4-1
4-1 编写函数strrindex(s,t),它返回字符串t在s中最右边出现的位置。如果s中不包含t,则返回-1 #include<stdio.h>#define MAXLINE 100int getline(char line[], int max);int strrindex(char s[], char t[]);char pattern[] =...
2010-07-19 09:44:03
182
原创 将输入中包含特定“模式”或字符串的各行打印出来
P57#include <stdio.h>#define MAXLINE 1000 /* maximum input line length */int getline(char line[], int max);int strindex(char source[], char searchfor[]);char pattern[] = "ould"; /*...
2010-07-16 22:07:15
244
原创 trim() 用于删除字符串尾部的空格符、制表符与换行符
/* trim: remove trailing blanks, tabs, newlines */int trim(char s[]){ int n; for (n = strlen(s)-1; n >= 0; n--) if (s[n] != ' ' && s[n] != '\t' && s[n] != '\n') b...
2010-07-16 21:44:42
1475
原创 atoi() 函数的逆过程 itoa()
/* itoa: convert n to characters in s */ void itoa(int n, char s[]) { int i, sign; if ((sign = n) < 0) /* record sign */ n = -n; /* make n positive */ i ...
2010-07-16 21:34:07
800
原创 C程序设计语言(第二版)3-3
3-3 编写函数expand(s1,s2),将字符串s1中类似与a-z一类的速记符号在字符串s2中扩展成等价的完整列表abc...xyz。该函数可以处理大小写字母和数字,并可以处理a-b-c、a-z0-9与-a-z等类似的情况 #include<stdio.h>#include<string.h>void expand(char* result,char...
2010-07-16 17:20:31
210
原创 希尔排序 与插入排序 C语言
希尔排序(Shell Sort)是插入排序的一种。是针对直接插入排序算法的改进。该方法又称缩小增量排序,希尔排序基本思想: 先取一个小于n的整数d1作为第一个增量,把文件的全部记录分成d1个组。所有距离为dl的倍数的记录放在同一个组中。先在各组内进行直接插入排序;然后,取第二个增量d2<d1重复上述的分组和排序,直至所取的增量dt=1(dt<dt-l<…<d2&...
2010-07-15 21:58:21
200
原创 C程序设计语言(第二版) 3-2
3-2 编写一个函数escape(s,t),将字符串s复制到字符串t中,并在复制过程中将换行符、制表符等不可见的字符分别转换成\n,\t等相应的可见的转义字符。再编写一个相反过程的函数。 #include <stdio.h>void escape(char s[],char t[]);void unescape(char s[],char t[]);int m...
2010-07-15 21:33:14
223
原创 C程序设计语言(第二版) 3-1
3-1 折半查找,2个版本 int binsearch(int x, int v[], int n) { int low, mid, high; low = 0; high = n - 1; while ( low <= high ) { mid = (low+high) / 2; ...
2010-07-15 16:50:52
156
原创 C程序设计语言(第二版) 2-9
2-9 bitcount()函数:统计x中值为1的二进制位数 #include <stdio.h> int bitcount(unsigned x){ int b; for(b=0;x!=0;x>>=1) if(x&1) b++; return b;} int main () { unsigned x...
2010-07-15 15:13:29
171
原创 C程序设计语言(第二版) 2-8 ☆
2-8 编写一个函数rightsort(x,n), 该函数返回将x循环右移n位后得到的值。 #include<stdio.h>unsigned rightrot(unsigned x,unsigned n);int main(){ unsigned x=5; unsigned n=1; unsigned result; result = r...
2010-07-15 11:32:26
270
1
各种工作流模式的实现.pdf
2010-04-07
Understanding the Linux Kernel, 2nd Edition
2009-09-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人