摘要: cat命令简单实现cat工具实现起来比较简单,下面代码采用基本的open、read、printf、close函数,基本可以实现cat命令的功能: 1 #include <stdio.h> 2 #include <unistd.h> 3 #include <fcntl.h> 4 5 #define READSIZE 4096 6 7 int main(int ac, char* av[]){ 8 int rfd=-1,rlen=-1,ret=-1; //被文件描述符、读取内容长度、程序返回值 9 char rbuf[READSIZE]; //读取内容缓冲1.. 阅读全文
posted @ 2011-11-03 16:20 李意锋 阅读(599) 评论(0) 推荐(1)
摘要: public class ThreadMain { 02 03 /** 04 * @param args 05 */06 public static void main(String[] args) { 07 08 /** 09 * 创建thread的子类,复写其run方法 10 */11 Thread thread = new Thread(){ 12 @Override13 public void run() { 14 while(true){ 15 try { 16 ... 阅读全文
posted @ 2011-10-04 09:34 李意锋 阅读(151) 评论(0) 推荐(0)