摘要: 1 #include <iostream> // for std::cout 2 #include <utility> // for std::pair 3 #include <algorithm> // for std::for_each 4 #include <vector> 5 using namespace std; 6 7 #include <string.h> 8 9 int main()10 {11 char temp[100] = "/a/b/c/d/e";12 char file[100];13 阅读全文
posted @ 2011-11-30 16:54 吃吃户 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 1 #include <unistd.h> 2 #include <sys/stat.h> 3 #include <stdio.h> 4 5 bool IsFileRead(const char * file_name) 6 { 7 int ret = access(file_name, R_OK); 8 /* 9 W_OK可写 X_OK可执行 F_OK是否存在10 */11 if (ret == 0)12 return true;13 return false;14 }15 bool IsRegFile(const char * ... 阅读全文
posted @ 2011-11-30 10:14 吃吃户 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 发现磁盘空间占满,但是删除那个文件后,df依然是100%执行lsof | grep deleted找到那个文件对应的程序,将那个程序kill掉就OK了。。。 阅读全文
posted @ 2011-11-29 20:38 吃吃户 阅读(519) 评论(0) 推荐(0) 编辑
摘要: 默认是ctrl+backspace是删除最后一个字符,可以通过命令stty erase ^H就可以通过backspace来删除了。。。其他控制字符相关请见http://www.yqdown.com/caozuoxitong/Linux/25725.htm 阅读全文
posted @ 2011-11-29 20:26 吃吃户 阅读(694) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.cnblogs.com/aga-j/archive/2011/08/26/2153943.htmlselect,poll,epoll简介selectselect本质上是通过设置或者检查存放fd标志位的数据结构来进行下一步处理。这样所带来的缺点是:1 单个进程可监视的fd数量被限制2 需要维护一个用来存放大量fd的数据结构,这样会使得用户空间和内核空间在传递该结构时复制开销大3 对socket进行扫描时是线性扫描pollpoll本质上和select没有区别,它将用户传入的数组拷贝到内核空间,然后查询每个fd对应的设备状态,如果设备就绪则在设备等待队列中加入一项并继续遍 阅读全文
posted @ 2011-11-23 09:54 吃吃户 阅读(980) 评论(0) 推荐(0) 编辑
摘要: 步骤1:等待数据到达网络,当分组到达时,它被拷贝到内核中某个缓冲区步骤2:将数据从内核缓冲区拷贝到应用缓冲区1.阻塞I/O 2.非阻塞I/O3.I/O复用4.信号驱动5.异步I/O综合 阅读全文
posted @ 2011-11-21 21:45 吃吃户 阅读(242) 评论(0) 推荐(0) 编辑
摘要: <!--判断用户输入的两次密码是否相等--><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"/><meta http-equiv="x-ua-compatible" content="ie=7"/><title>标题:密码检查</title><meta name="description" cont 阅读全文
posted @ 2011-11-17 11:21 吃吃户 阅读(8331) 评论(0) 推荐(0) 编辑
摘要: test.h1 #ifndef _TEST_H_2 #define _TEST_H_3 4 void TestA();5 void TestB();6 7 #endiftest_a.cpp1 #include <stdio.h>2 #include "test.h"3 4 void TestA()5 {6 printf("TestA func\n");7 }test_b.cpp1 #include <stdio.h>2 #include "test.h"3 4 void TestB()5 {6 printf(& 阅读全文
posted @ 2011-11-15 12:51 吃吃户 阅读(27486) 评论(2) 推荐(2) 编辑
摘要: 首先,我们不应该太在意这两个词的中文翻译,因为都可以。仿真(simulation)是对现实变幻的模仿,比如产生仿真报文的过程,过程是真的,但输入是假的。而模拟(emulation),输入是真的,过程是假的。比如模拟的软件,CPU等。 阅读全文
posted @ 2011-11-14 00:05 吃吃户 阅读(7417) 评论(0) 推荐(0) 编辑
摘要: http://blog.sina.com.cn/s/blog_698db75d0100k11l.html 阅读全文
posted @ 2011-11-14 00:04 吃吃户 阅读(144) 评论(0) 推荐(0) 编辑