C/C++/VC MFC char & int study
²âÊÔ´úÂëÒ»£¨VC6.0¡¢C-code£©£º
#include <stdio.h>
void main()
{
int aa;
unsigned char j1,j2;
aa=j1=j2=0;
aa=49;
j1=aa;
printf("j1=%d \n",j1);
j2=aa;
printf("j2=%c \n",j2);
}
¡¾·ÖÎö¡¿£º
[1]ÕýÈçËùÏëÏóµÄÊä³ö½á¹û£º
j1=49
j2=1
Press any key to continue
[2]ÏÈ˵Ã÷aaÔÚÄÚ´æÖеĴ洢ÐÎʽ£º0x0031£»
[3]j1 ,j2ͬΪunsigned charÐÍÊý¾Ý£»
[4]ÉÏÊö¶þ±äÁ¿Êä³ö½á¹û²»Ò»Ö£»ÓÉprinf£¨£©º¯ÊýÖеĸñʽ·û²»Í¬ËùÖ£»
[5]ÕâÀïÈÏΪ£ºÆäÒ»£¬¶ÔÓÚ %d¸ñʽ·û£¬pintf()ÄÜ“ÕýÈ·”·´Ó³ j1 Öд洢µÄÊý¾Ý£»
Æä¶þ£¬¶ÔÓÚ %c¸ñʽ·û£¬printf() È´²»ÄÜ“ÕýÈ·”·´Ó³ j2(==aa)Öд洢µÄ¶þ½øÖÆÊý¾Ý¡£
[6]¶ÔÓÚÒÔÉÏ·ÖÎöµÄÀí½â£ºÏÔÈ»£¬printf()º¯Êý½«»áÒÀÕÕÓû§Ìṩ¸øËüµÄ ¸ñʽ·û ¶Ô´ýÊä³öµÄÊý¾Ý½øÐÐ
“´¦À픺ó£¬Êä³öÖÁÏÔʾÉ豸ÉÏ¡£
[7]……
²âÊÔ´úÂë¶þ(VC6.0 ,VC mfc)£º
int aa,bb;
aa=bb=0;
CString strtemp,display;
strtemp.Format("%c",170); //170==0xAA
MessageBox(strtemp);
int length=strtemp.GetLength();
for(int i=0;i<length;i++)
{
aa+=strtemp.GetAt(i);
bb+=(unsigned char)strtemp.GetAt(i);
}
display.Format("(TCHAR)aa=%x",aa);
MessageBox(display);
display.Format("(unsigned char)bb=%x",bb);
MessageBox(display);
¡¾·ÖÎö¡¿£º
[1]Êä³öÇåµ¥ÈçÏ£º
MessageBox(strtemp);===== "?"
display.Format("(TCHAR)aa=%x",aa);
MessageBox(display);====="(TCHAR)aa=ffffffaa" //(ff ff ff aa)
display.Format("(unsigned char)bb=%x",bb);
MessageBox(display);====="("(unsigned char)bb=aa"
[2] // return single character at zero-based index
TCHAR GetAt(int nIndex) const;
<À´Ô´£ºCString-class£»×îÖÕ½âÊÍΪmicrosoft VC6.0>
[3]typedef char TCHAR, *PT
Ïà¹ØÎĵµ£º
50¸öc/c++Ô´´úÂëÍøÕ¾
ÎÄÕ³ö´¦£ºhttp://blog.chinaunix.net/u3/106835/showart_2190632.html
C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâЩÍøÕ¾Ìṩc/c++Ô´´úÂë
¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒѾ¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ ......
#include <iostream>
using namespace std;
class Base {
public:
virtual void fn(int x) {
cout << "In Base class, int x = " << x << endl;
}
};
class SubClass : public Base {
public:
// º¯ÊýµÄÖØÔØ,ÕâÑùµÄÖØÔØ·½Ê½,ÔÚJavaÖÐÄÜÐÐ,ÔÚC/C++ÖÐÈ´²»ÐÐ
virt ......
c/sÊÇ¿Í»§¶ËºÍ·þÎñÆ÷£¬b/sÊÇä¯ÀÀÆ÷ºÍ·þÎñÆ÷¡£
c/sÔÚ¿Í»§¶ËÒª°²×°Èí¼þµÄ£¬b/sÖ»ÒªÓÐIE¾Í¿ÉÒÔä¯ÀÀ¡£
c/sµÄÀ©Õ¹Éý¼¶±È½ÏÀ§ÄÑ£¬b/s¾ÍºÜÈÝÒ׵ġ£
c/sµÄ°²È«ÐÔºÃһЩ£¬b/s¾ÍûÓÐc/sµÄ¸ß¡£
c/sÒ»°ãÓÃÔÚ¾ÖÓòÍø£¬b/sÒ»°ãÓÃÔÚ¹ãÓòÍø¡£
------------------------------------------------
C/SÔËÓÃÔÚÓÐרÓÃÐԵij¡ºÏ¡£±ÈÈç ......
¸Ãmakefile Ö»ÊÇÔÚlinux ÖвâÊÔ¹ý£¬ Èô²ÉÓÃhu-ux Ö»ÒªÒÔÏÂmakefileÖеÄgcc ¸ÄΪaCC µ«
hu-ux δ²âÊÔ
1¡¢Ê×ÏÈÈ·¶¨pro*c ¹¤³ÌĿ¼½á¹¹
proc/bin
proc/include
proc/lib
proc/src
src/libsrc
src/project_src
&n ......
1.·Ö²ãÉè¼Æ£¬¸ôÀëƽ̨Ïà¹ØµÄ´úÂë¡£¾ÍÏñ¿É²âÊÔÐÔÒ»Ñù£¬¿ÉÒÆÖ²ÐÔÒ²Òª´ÓÉè¼Æ×¥Æð¡£Ò»°ãÀ´Ëµ£¬×îÉϲãºÍ×îϲ㶼²»¾ßÓÐÁ¼ºÃµÄ¿ÉÒÆÖ²ÐÔ¡£×îÉϲãÊÇGUI£¬´ó¶àÊýGUI¶¼²»ÊÇ¿çƽ̨µÄ£¬ÈçWin32 SDKºÍMFC¡£×îϲãÊDzÙ×÷ϵͳAPI£¬´ó¶à²¿·Ö²Ù×÷ϵͳAPI¶¼ÊÇרÓõġ£
¡¡¡¡Èç¹ûÕâÁ½²ãµÄ´úÂëÉ¢²¼ÔÚÕû¸öÈí¼þÖУ¬ÄÇôÕâ¸öÈí¼þµÄ¿ÉÖ²ÐÔ½«·Ç³£µÄ² ......