jeans chen
we've got them by the balls
摘要: (转)sizeof()和_countof()先看程序:#include using namespace std; int main(int argc, char* argv[]){ char *a = "abcde"; char sz1[] = "abc"; char sz2[] = {"abc"}; char sz3[] = { 'a', 'b', 'c' }; printf_s( "%d %d %d %d", _sizeof(a), _countof(sz1), 阅读全文
posted @ 2013-11-21 16:03 jeans chen 阅读(634) 评论(0) 推荐(0) 编辑
摘要: dup() 和 dup2() 2011-10-07 11:06:31|分类: Linux学习心得 |字号订阅dup和dup2都可用来复制一个现存的文件描述符,使两个文件描述符指向同一个file结构体。#include int dup(int newfd);int dup2(int newfd, int oldfd); 下面用一个简单的例子解释两个函数的用法和区别:#include #include #include #include #include #include int main(void){ int fd, save_fd; char msg[] = "This is a t 阅读全文
posted @ 2013-11-21 14:10 jeans chen 阅读(227) 评论(0) 推荐(0) 编辑