摘要: 1、IPC的持久性1)进程相关的:IPC中数据一直存在到最后一个关联进程关闭时pipe、fifo等2)内核相关的IPC:IPC中数据一直存在,除非内核重启或删除消息队列,共享内存等3)文件系统相关的IPC:IPC中数据一直存在,除非显式删除文件2、管道匿名管道(pipe):只能用于同一个祖先的进程组有名管道(fifo):不相关的进程也可以使用3、匿名管道int pipe(int filedes[2]);fildes[0] 用于从管道中读取数据fildes[1] 用于将数据写入管道不需要open,直接read/write 等系统调用系统自动删除,进程不需要考虑示例View Code #inclu 阅读全文
posted @ 2011-09-10 21:27 浪里飞 阅读(1065) 评论(0) 推荐(0)
摘要: string类的push_back的应用-按字符存储数据示例View Code #include <iostream>#include <fstream>#include <string>using namespace std;int main (){ string str; ifstream file("F:\\log.txt",ios::in); while (!file.eof()) { str.push_back(file.get()); } cout << str; return 0;} 阅读全文
posted @ 2011-09-10 14:06 浪里飞 阅读(808) 评论(0) 推荐(0)