程序设计
linux程序如何支持插件
by czyhd on 七.27, 2009, under 程序设计
今天小猴同学在研究这个,我也看了下。
给两段代码
1,插件部分,so.c
int add( int a, int b){
return a+b;
}
编译
gcc -c -fPIC so.c
gcc -shared -fPIC so.o -o so.so
玩了一下Brainfuck
by czyhd on 十二.27, 2008, under Linux, 程序设计
很意外的发现ubuntu有个bf命令,然后装上了,一种很扯淡的语言..
随手写了一个..
++++++++++
[
>+++++++>+++>++++++++++>++++++++++++>+<<<<<-
]
>+++.
>++.
>++++++++.
+++.
+++++++.
—————–.
<.
>>+.
<<+.
>>>.
存在一个文件里,比如temp,然后在终端执行
bf temp
会打印一行字符..
I love Y!
其实还是蛮好玩的,参见
http://en.wikipedia.org/wiki/Brainfuck
改改名字就更好了..
一个简单的huffman压缩程序
by czyhd on 四.27, 2008, under 程序设计
基于huffman编码
压缩非常有限
原来用pascal写过,
但是由于编码问题,
很多文件会越压越大
现在用c重新写了一下,
算是把那项工作完成了吧~~~
用dev c++在windows xp下测试通过
关于搜索的ppt
by czyhd on 五.24, 2007, under 程序设计
答应许哥去一中讲搜索的…然后就和ghost写了个ppt,感觉并没有多少技术含量……
帖这里了…
[file][attach]12[/attach][/file]
很不错的代码
by czyhd on 三.19, 2007, under 程序设计
猜猜这个代码是干什么的?
^_^
编译运行看看,圆周率,800位!
#include
long a=10000,b,c=2800,d,e,f[2801],g;
main()
{for(;b-c;)f[b++]=a/5;
for(;d=0,g=c*2;c-=14,printf(“%.4d”,e+d/a),e=d%a)
for(b=c;d+=f[b]*a,f[b]=d%–g,d/=g–,–b;d*=b);
}
此代码是ghost发给我的….