上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 25 下一页
摘要: 虽然知道怎么做,但是还是做一遍啦。结果调试了两个多小时,真崩溃。/* * ===================================================================================== * * Filename: intlist.h * * Description: * * Version: 1.0 * Created: 09/16/2011 02:56:13 AM * Revision: none * Compiler: gcc * * ... 阅读全文
posted @ 2011-09-17 20:50 westfly 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 今天看某个面试题,实现memcpy,吓了一跳,怎么还要求考虑内存重合啊。印象中不是这样子的啊。于是将以前写的代码翻出来看了看。在这里重新温习下。1.memmove函数原型:void*memmove(void*dest, constvoid*source, size_t count)返回值说明:返回指向dest的void *指针参数说明:dest,source分别为目标串和源串的首地址。count为要移动的字符的个数函数说明:memmove用于从source拷贝count个字符到dest,如果目标区域和源区域有重叠的话,memmove能够保证源串在被覆盖之前将重叠区域的字节拷贝到目标区域中。2. 阅读全文
posted @ 2011-09-15 15:35 westfly 阅读(1085) 评论(4) 推荐(0) 编辑
摘要: C++中的空类,默认产生哪些类成员函数?[C++易]答:class Empty{public: Empty(); // 缺省构造函数 Empty( const Empty& ); // 拷贝构造函数~Empty(); // 析构函数 Empty&operator=( const Empty& ); // 赋值运算符 Empty*operator&(); // 取址运算符const Empty*operator&() cons... 阅读全文
posted @ 2011-09-15 15:02 westfly 阅读(591) 评论(1) 推荐(0) 编辑
摘要: 遇到这样一道题,注释以及很清楚,覆盖是覆盖了,但是可以用using指令使其可见,并成功调用,注意灰显部分。#include <iostream>using namespace std;class Base{public: virtual void func(){cout<<"Base::func()"<<endl;} void gunc(){cout<<"Base::gunc()"<<endl;}};class Derived:public Base{public: void func(){co 阅读全文
posted @ 2011-09-15 11:58 westfly 阅读(255) 评论(0) 推荐(0) 编辑
摘要: abc说明:定义 del 函数的时候,abc 的析构函数未定义,因此不会调用。看如下代码,试解释器运行结果#include <stdio.h>class abc;void del(abc *pobj){ delete pobj;}class abc{public: abc() { printf("abc\r\n"); } ~abc() { printf("~abc\r\n"); } }; int main(int argc, char *argv[]) { abc *pobj = new abc; de... 阅读全文
posted @ 2011-09-15 11:38 westfly 阅读(846) 评论(0) 推荐(0) 编辑
摘要: 题目:类CMyString的声明如下:class CMyString{public: CMyString(char* pData = NULL); CMyString(const CMyString& str); ~CMyString(void); CMyString& operator = (const CMyString& str);private: char* m_pData;}; 请实现其赋值运算符的重载函数,要求异常安全,即当对一个对象进行赋值时发生异常,对象的状态不能改变。分析:首先我们来看一般C++教科书上给出的赋值运算符的重载... 阅读全文
posted @ 2011-09-15 10:50 westfly 阅读(643) 评论(0) 推荐(1) 编辑
摘要: Programming LanguagesCAPIBerkeley Socket APIData Structure used to store socked details1234567struct sockaddr_in6 {u_char sin6_len; // length of this structureu_char sin6_family; // AF_INET6u_int16m_t sin6_port; // Transport layer port #u_int32m_t sin6_flowinfo; // IPv6 flow informationstruct in6_ad 阅读全文
posted @ 2011-09-10 18:57 westfly 阅读(578) 评论(0) 推荐(0) 编辑
摘要: Berkeley Socket API – Creating a TCP/IP Server in CProgramming LanguagesCAPIBerkeley Socket APIWhat are sockets?“In computer networking, an Internetsocket (or commonly, a network socket or socket) is the endpoint of a bidirectional inter-process communication flow across an Internet Protocol-based c 阅读全文
posted @ 2011-09-10 18:56 westfly 阅读(685) 评论(0) 推荐(0) 编辑
摘要: 作者:iTech出处:http://itech.cnblogs.com/[C++对象模型][1]目录与参考C++对象模型系列:本系列是主要是作者经验的总结且同时参考了大量的网络文章,希望能够给C++的学习者有所帮助,但是由于作者水平有限,难免有错,希望大家能够指出,我将虚心地向大家学习,与大家共同进步!本系列的开发环境是Windows 32+VS2008。文章:指针和引用指针与数组指针与字符串堆栈与函数调用sizeof与对象内存布局单继承与虚函数表多重继承与虚函数表虚继承与虚函数表类型转化参考:1) C++对象模型C++对象模型笔记:http://blog.csdn.net/ZengMuAnS 阅读全文
posted @ 2011-09-10 08:41 westfly 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 用setsockopt()来控制recv()与send()的超时在send(),recv()过程中有时由于网络状况等原因,收发不能预期进行,而设置收发超时控制:在Linux下需要注意的是时间的控制结构是struct timeval而并不是某一整型数,以下是来自于网上一篇文章中的摘录,它是这样写的:int nNetTimeout=1000;//1秒,//设置发送超时setsockopt(socket,SOL_SOCKET,SO_SNDTIMEO,(char *)&nNetTimeout,sizeof(int));//设置接收超时setsockopt(socket,SOL_SOCKET,S 阅读全文
posted @ 2011-09-08 12:17 westfly 阅读(658) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 25 下一页