上一页 1 ··· 54 55 56 57 58 59 60 61 62 ··· 73 下一页
摘要: #include <unistd.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#include <stdlib.h>int main(){ char block[1024]; int in,out; int nread; in=open("file.in",O_RDONLY); out=open("file.out",O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR); while ((nread= 阅读全文
posted @ 2012-09-06 14:12 Dsp Tian 阅读(715) 评论(0) 推荐(0) 编辑
摘要: #include <unistd.h>#include <stdlib.h>int main(){ char buffer[128]; int nread; nread=read(0,buffer,128); if(nread==-1) write(2,"A read error has occurred\n",26); if((write(1,buffer,nread))!=nread) write(2,"A write error has occurred\n"... 阅读全文
posted @ 2012-09-02 17:43 Dsp Tian 阅读(640) 评论(0) 推荐(0) 编辑
摘要: #include <unistd.h>#include <stdlib.h>int main(){ if((write(1,"here is some data\n",18))!=18) write(2,"write error\n",12); exit(0);}原型:#include <unistd.h>size_t write(int fildes,const void *buf,size_t nbytes);write()的第一个参数:0标准输入,1标准输出,2标准错误 第二个参数:写入的数据 第三个参数:写入如 阅读全文
posted @ 2012-09-02 16:46 Dsp Tian 阅读(1541) 评论(0) 推荐(0) 编辑
摘要: 偶然在http://forum.ubuntu.org.cn上看到一个帖子中有一个随机变化的linux技巧表,就将其js脚本搞了出来,代码中写的技巧都挺有用的。tips = new Array(222);code = new Array(222);tips[0] = '查看软件xxx安装内容';code[0] = 'dpkg -L xxx';tips[1] = '查找软件库中的软件';code[1] = 'apt-cache search 正则表达式';tips[2] = '查找软件库中的软件';code[2] = 阅读全文
posted @ 2012-08-10 15:53 Dsp Tian 阅读(1135) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <set> using namespace std; int main() { string name[]={"tian","dsp","sp","ti"}; set<string> setname; fo 阅读全文
posted @ 2012-07-26 16:23 Dsp Tian 阅读(786) 评论(0) 推荐(0) 编辑
摘要: #pragma warning (disable:4786)#include <string>#include <iostream>#include <map>using namespace std;int main(){ string name[]={"tian","dsp","su","chu"}; map<int,string> mapname; for (int i=0;i<4;i++) { mapname.insert(pair<int,stri 阅读全文
posted @ 2012-07-26 15:48 Dsp Tian 阅读(572) 评论(0) 推荐(0) 编辑
摘要: sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行为单位进行处理,可以将数据行进行替换、删除、新增、选取等特定工作,下面先了解一下sed的用法sed命令行格式为: sed [-nefri] ‘command’ 输入文本 常用选项: -n∶使用安静(silent)模式。在一般 sed 的用 阅读全文
posted @ 2012-07-25 16:45 Dsp Tian 阅读(514) 评论(0) 推荐(0) 编辑
摘要: 查看Ubuntu版本:cat /etc/issue查看linux内核版本:uname -a查看cpu相关信息:cat /proc/cpuinfo 阅读全文
posted @ 2012-07-22 14:29 Dsp Tian 阅读(447) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/expectset password "你的密码"spawn ssh -qTfnN -D 7070 tiandsp@216.194.70.6expect "tiandsp@216.194.70.6's password:"send "$password\r"expect "*$"send "exit\r" 阅读全文
posted @ 2012-07-22 11:38 Dsp Tian 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 只显示文件名:ls -l | grep ^[^d] | awk '{print $8}'只显示文件夹名:ls -l |grep ^d | awk '{print $8}' 或者是 ls -d */ 阅读全文
posted @ 2012-07-21 14:16 Dsp Tian 阅读(7770) 评论(0) 推荐(0) 编辑
上一页 1 ··· 54 55 56 57 58 59 60 61 62 ··· 73 下一页