1.tcpÖÐsend£¨£©Á½´ÎrecvÒª¼¸´Î¡£»»³ÉudpÓÖÔõÑù¡£ÎªÊ²Ã´¡£
tcp·¢ËÍ0×ֽڵĻáÊյĵ½Âð£¿udpÓÖ»áÈçºÎ£¿
makefileÖÐ=£¬£º=£¬£¿=µÄÇø±ð£¿
tcpÖÐÔõô¿ØÖÆconnectionµÄÁ¬½Ó³¬Ê±¡£
2.д¸öÑ»·Ë«Á´±íµÄ´úÂë,×Ô¼ºÐ´¡£ËûÌṩ¼¸¸öº¯ÊýÃû
3.¹ØÓÚ½ø³Ì¼äͨÐÅ
4.ÖÇÉÌÌâ
±ÊÊÔ
1.int a[][2] = {{a,b},{c,d}}
char **p = a;
printf(¡°%s\n¡±,*(p+1));
p++;
printf(¡°%s\n¡±,*p + 1);
Êä³öÒÔϽá¹û:
%s²»ÄÜÊä³öchar ÀàÐ͵ıäÁ¿¡£ÒªÅ׳öÒì³£
¿ÉÄܽá¹û:
1.Ìáʾ b c d 䶨Òå µÚÒ»ÐÐȱÉÙ¡¯;¡¯
2.cd
b
2.stringÀà,д³öÀຯÊý
string
{
public:
string(const char *str = NULL);
string(const string &other);
~string(void);
string &operator =( const string &other);
private:
char *m_pstr;
}
/////////////////////
string::string(const char *str)
{
If(str != NULL)
{
Int length = strlen(str);
M_pstr = new char[length+1];
Strcpy(m_pstr,str);
}
Else
{
M_pstr = new char[1];
*M_pstr = ¡®\0¡¯;
}
}
string ::string(const string &other)
{
If(other.m_pstr != NULL)
{
Int length = strlen(str);
M_pstr = new char[length+1];
Strcpy(m_pstr,str);
}
Else
{
M_pstr = new char[1];
*M_pstr = ¡®\0¡¯;
}
}
string ::string::string(void)
{
Free m_pstr;
}
string & string::operator =( const string &other)
{
If(this == &other)
Return *this;
Free(m_pstr);
If(other.m_pstr != NULL)
{
//Free(m_pstr);
Malloc(m_pstr,strlen(other.m_pstr)+1);
Strcpy(m_pstr, other.m_pstr);
}
Else
M_pstr = NULL;
Return *this;
}
3.ÀûÓõݹéʵÏÖÊäÈë1ÊäÈë11,ÊäÈë12Êä³ö1122
//ÕýÈ·´ð°¸
Void func(char *output)
{
Char *p = output;
If(*p != ¡®\0¡¯)
{
Printf(¡°%c%c¡±,*p,*p);
}
Else
{
Printf(¡°\nover!\n¡±);
Return ;
}
Func(++p);
}
void printDoubleNum(int num)
{
Int i = 0;
Int first = 0;
Int second = 0;
If(num/10 == 0)
{
Printf(¡°%d%d¡±,second);
Fflush();
Return ;
}
While(1)
{
If((first = num/Pow(10,i)) != 0)
{
Second = first;
I++;
}
Else
Break;
}
Printf(¡°%d%d¡±,second);
Fflush();
Int val = num ¨C second*pow(10, i-1);
printDoubleNum(val);
}
4. void GetMemory(char *p)
{
p = (char *)malloc(100);
}
void Test(void)
{
char *str = NULL;
GetMemory(str);
strcpy(str, ¡±hello world¡±);
printf(str);
}
Êä³ö½á¹û: ¶Î´íÎó
Ϊʲô: GetMemory²»ÄÜ´«µÝ¶¯Ì¬ÄÚ´æ
5.char *p;
char a[5][5];
char *q = (char *)malloc(100);
printf(¡°%d\n¡±,sizeof(p));
printf(¡°%d\n¡±,sizeof(a));
printf(¡°%d\n¡±,sizeof(a[5][5]));
printf(¡°%d\n¡±,sizeof(q));
Êä³ö½á¹û:
4
25
1
4£¨ÒòΪq²»ÊÇÊý×飩
6.ÖØÔØºÍÖØ¶¨ÒåµÄÇø±ð
ÖØÔØÊÇÔÚͬһ¸öÀàÖУ¬Í¬Ò»¸öº¯ÊýÃû£¬ÒòËüÃǵIJÎÊýµÄλÖ㬲ÎÊýµÄÀàÐÍ£¬ÅÅÁÐ˳Ðò²»Ò»Ñù£¬Ê¹ÔÚµ÷ÓõÄʱºò¸ù¾Ý²»Í¬Çé¿öµ÷Óò»Í¬µÄº¯Êý
×ÓÀàÖØÐ¶¨Ò常ÀàÖÐÓÐÏàͬÃû³ÆµÄ·ÇÐ麯Êý ( ²ÎÊýÁбí¿ÉÒÔ²»Í¬ ) ¡£
ÓмÓvirtual ¾Í½Ð×ö¸²¸Ç
7.½áÊøÏ̺߳ͽø³ÌÓÐÄÄЩ·½Ê½
½áÊøỊ̈߳º1¡£ÔÚº¯ÊýÖÐÓÃreturn,Äܻص½µ÷ÓÃÏ̺߳¯ÊýµÄÏ̡߳£
2£®×ÔÏß³ÌÄÚµ÷Óà ÓÃThread_exit(void *exit_val);
3£®Ïß³ÌÍâÃæµ÷Óà terminate_thread(HANDLE ht)ÄܽáÊø±êʶΪhtµÄÏß³Ì
4£®Ö÷Ï߳̽áÊøÊ±¡£ÆäËüÏß³ÌÒ²²»ÄÜ´æÔÚ
½áÊø½ø³Ì£º1¡£ÔÚº¯ÊýÖÐÓÃexit(),ÄܽáÊø½ø³Ì¡£
2£®½ø³ÌÊÕµ½Ðźţ¬¶ø´ËÐźÅûÓд¦Àí£¬»òÊÇ´¦Àí²ÉÈ¡Á˽áÊø½ø³ÌµÄ¶¯×÷.
.
8.˵³öMFCÖÐÓÐÄÇЩGDIµÄÀà
CPen »±Ê
CBrush »Ë¢
HFONT ×ÖÌå
HBITMAP λͼ
HPALETTE µ÷É«°å
HRGN ÇøÓò
GDIÄÚ´æ(Èç×öË«»º³åÓÃ)
DCcommplimap
CObject