Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : c++

[C/C++ Digestion] – ×Ôµ×ÏòÉϵØ̽¾¿Ð麯Êý


[C/C++ Digestion] –
×Ôµ×ÏòÉϵØ̽¾¿Ð麯Êý
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-05-19
»·¾³£º
Visual C++ Express
2008
ÉùÃ÷£º±¾ÎÄ·¢±íÔÚ
csdn
²©¿Í£¬ÈçÓÐתÔØ£¬Çë×¢Ã÷³ö´¦
 
[1]C++
¶ÔÏóÄ£ÐÍ»ù´¡
Ò»¸öÀàÖпÉÒÔ°üº¬¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯Êý¡¢·Ç¾²Ì¬³ÉÔ±º¯ÊýºÍ·Ç¾²Ì¬Êý¾Ý³ÉÔ±ÒÔ¼°Ð麯Êý¡£ÆäÖУ¬Ç°ÈýÕߣ¨¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯Êý¡¢·Ç¾²Ì¬³ÉÔ±º¯Êý£©¶¼²¢Ã»Óб»·Åµ½¶ÔÏóµÄ²¼¾ÖÖУ¬¿ÉÒÔ´ÓÒÔÏÂÁ½¶Î´úÂëµÃµ½ÑéÖ¤£º
#include <iostream>
using namespace std;

class Base {
};

int main(){
Base a;
cout << sizeof (a) << endl;// Êä³ö1
return 0;
}
ÉÏÊöµÄ
Base
ÀàÊÇÒ»¸ö¿ÕÀ࣬ռ¾ÝÁËÒ»¸ö×Ö½ÚµÄÄÚ´æ¿Õ¼ä£¬ÕâÊÇΪÁ˱£Ö¤Ã¿¸öÀàʵÀý»¯ºó¶¼ÓµÓжÀÒ»ÎÞ¶þµÄÄÚ´æ¿Õ¼ä¡£½Ó×ÅÎÒÃÇÍù
Base
ÀàÖÐÌí¼Ó¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯ÊýºÍ·Ç¾²Ì¬³ÉÔ±º¯Êý£º
#include <iostream>
using namespace std;

class Base {
public :
Base(){}
~Base(){}
static int v1;
static void f1(){}
void f2(){}
};

int main(){
Base a; ......

[C/C++ Digestion] – ×Ôµ×ÏòÉϵØ̽¾¿Ð麯Êý


[C/C++ Digestion] –
×Ôµ×ÏòÉϵØ̽¾¿Ð麯Êý
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-05-19
»·¾³£º
Visual C++ Express
2008
ÉùÃ÷£º±¾ÎÄ·¢±íÔÚ
csdn
²©¿Í£¬ÈçÓÐתÔØ£¬Çë×¢Ã÷³ö´¦
 
[1]C++
¶ÔÏóÄ£ÐÍ»ù´¡
Ò»¸öÀàÖпÉÒÔ°üº¬¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯Êý¡¢·Ç¾²Ì¬³ÉÔ±º¯ÊýºÍ·Ç¾²Ì¬Êý¾Ý³ÉÔ±ÒÔ¼°Ð麯Êý¡£ÆäÖУ¬Ç°ÈýÕߣ¨¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯Êý¡¢·Ç¾²Ì¬³ÉÔ±º¯Êý£©¶¼²¢Ã»Óб»·Åµ½¶ÔÏóµÄ²¼¾ÖÖУ¬¿ÉÒÔ´ÓÒÔÏÂÁ½¶Î´úÂëµÃµ½ÑéÖ¤£º
#include <iostream>
using namespace std;

class Base {
};

int main(){
Base a;
cout << sizeof (a) << endl;// Êä³ö1
return 0;
}
ÉÏÊöµÄ
Base
ÀàÊÇÒ»¸ö¿ÕÀ࣬ռ¾ÝÁËÒ»¸ö×Ö½ÚµÄÄÚ´æ¿Õ¼ä£¬ÕâÊÇΪÁ˱£Ö¤Ã¿¸öÀàʵÀý»¯ºó¶¼ÓµÓжÀÒ»ÎÞ¶þµÄÄÚ´æ¿Õ¼ä¡£½Ó×ÅÎÒÃÇÍù
Base
ÀàÖÐÌí¼Ó¾²Ì¬Êý¾Ý³ÉÔ±¡¢¾²Ì¬³ÉÔ±º¯ÊýºÍ·Ç¾²Ì¬³ÉÔ±º¯Êý£º
#include <iostream>
using namespace std;

class Base {
public :
Base(){}
~Base(){}
static int v1;
static void f1(){}
void f2(){}
};

int main(){
Base a; ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tmת»»

(ת)C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tmת»»
ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã£©£¬clock tick£¨Ê±ÖÓ¼Æʱµ¥Ôª£©
1£®¸ÅÄî
ÔÚ C/C++ÖУ¬¶Ô×Ö·û´®µÄ²Ù×÷ÓкܶàÖµµÃ×¢ÒâµÄÎÊÌ⣬ͬÑù£¬C/C++¶Ôʱ¼äµÄ²Ù×÷Ò²ÓÐÐí¶àÖµµÃ´ó¼Ò×¢ÒâµÄµØ·½¡£×î½ü£¬ÔÚ¼¼ÊõȺÖÐÓкܶàÍøÓÑÒ²¶à´ÎÎʵ½¹ý C++ÓïÑÔÖжÔʱ¼äµÄ²Ù×÷¡¢»ñÈ¡ºÍÏÔʾµÈµÈµÄÎÊÌâ¡£ÏÂÃ棬ÔÚÕâƪÎÄÕÂÖУ¬±ÊÕß½«Ö÷Òª½éÉÜÔÚC/C++ÖÐʱ¼äºÍÈÕÆÚµÄʹÓ÷½·¨.
ͨ¹ýѧϰÐí¶àC/C++¿â£¬Äã¿ÉÒÔÓкܶà²Ù×÷¡¢Ê¹ÓÃʱ¼äµÄ·½·¨¡£µ«ÔÚÕâ֮ǰÄãÐèÒªÁ˽âһЩ“ʱ¼ä”ºÍ“ÈÕÆÚ”µÄ¸ÅÄÖ÷ÒªÓÐÒÔϼ¸¸ö£º
Coordinated Universal Time£¨UTC£©£ºÐ­µ÷ÊÀ½çʱ£¬ÓÖ³ÆΪÊÀ½ç±ê׼ʱ¼ä£¬Ò²¾ÍÊÇ´ó¼ÒËùÊìÖªµÄ¸ñÁÖÍþÖαê׼ʱ¼ä£¨Greenwich Mean Time£¬GMT£©¡£±ÈÈ磬ÖйúÄڵصÄʱ¼äÓëUTCµÄʱ²îΪ+8£¬Ò²¾ÍÊÇUTC+8¡£ÃÀ¹úÊÇUTC-5¡£
Calendar Time£ºÈÕÀúʱ ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tmת»»

(ת)C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tmת»»
ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã£©£¬clock tick£¨Ê±ÖÓ¼Æʱµ¥Ôª£©
1£®¸ÅÄî
ÔÚ C/C++ÖУ¬¶Ô×Ö·û´®µÄ²Ù×÷ÓкܶàÖµµÃ×¢ÒâµÄÎÊÌ⣬ͬÑù£¬C/C++¶Ôʱ¼äµÄ²Ù×÷Ò²ÓÐÐí¶àÖµµÃ´ó¼Ò×¢ÒâµÄµØ·½¡£×î½ü£¬ÔÚ¼¼ÊõȺÖÐÓкܶàÍøÓÑÒ²¶à´ÎÎʵ½¹ý C++ÓïÑÔÖжÔʱ¼äµÄ²Ù×÷¡¢»ñÈ¡ºÍÏÔʾµÈµÈµÄÎÊÌâ¡£ÏÂÃ棬ÔÚÕâƪÎÄÕÂÖУ¬±ÊÕß½«Ö÷Òª½éÉÜÔÚC/C++ÖÐʱ¼äºÍÈÕÆÚµÄʹÓ÷½·¨.
ͨ¹ýѧϰÐí¶àC/C++¿â£¬Äã¿ÉÒÔÓкܶà²Ù×÷¡¢Ê¹ÓÃʱ¼äµÄ·½·¨¡£µ«ÔÚÕâ֮ǰÄãÐèÒªÁ˽âһЩ“ʱ¼ä”ºÍ“ÈÕÆÚ”µÄ¸ÅÄÖ÷ÒªÓÐÒÔϼ¸¸ö£º
Coordinated Universal Time£¨UTC£©£ºÐ­µ÷ÊÀ½çʱ£¬ÓÖ³ÆΪÊÀ½ç±ê׼ʱ¼ä£¬Ò²¾ÍÊÇ´ó¼ÒËùÊìÖªµÄ¸ñÁÖÍþÖαê׼ʱ¼ä£¨Greenwich Mean Time£¬GMT£©¡£±ÈÈ磬ÖйúÄڵصÄʱ¼äÓëUTCµÄʱ²îΪ+8£¬Ò²¾ÍÊÇUTC+8¡£ÃÀ¹úÊÇUTC-5¡£
Calendar Time£ºÈÕÀúʱ ......

±à³ÌÒÕÊõ(C/C++)


1¡¢¿ìËÙ³õʼ»¯
char  *str = new [size];
str[0]='\0';
 
 
2¡¢memcpyµÄÃîÓÃ
 
ÊÔÌâ6£ºÒÑÖªWAVÎļþ¸ñʽÈçÏÂ±í£¬´ò¿ªÒ»¸öWAVÎļþ£¬ÒÔÊʵ±µÄÊý¾Ý½á¹¹×éÖ¯WAVÎļþÍ·²¢½âÎöWAV¸ñʽµÄ¸÷ÏîÐÅÏ¢¡£
  WAVEÎļþ¸ñʽ˵Ã÷±í
Æ«ÒƵØÖ· ×Ö½ÚÊý Êý¾ÝÀàÐÍ ÄÚ ÈÝ
ÎļþÍ·
00H 4 Char "RIFF"±êÖ¾
04H 4 int32 Îļþ³¤¶È
08H 4 Char "WAVE"±êÖ¾
0CH 4 Char "fmt"±êÖ¾
10H 4   ¹ý¶É×Ö½Ú£¨²»¶¨£©
14H 2 int16 ¸ñʽÀà±ð
16H 2 int16 ͨµÀÊý
18H 2 int16
²ÉÑùÂÊ£¨Ã¿ÃëÑù±¾Êý£©£¬±íʾÿ¸öͨµÀµÄ²¥·ÅËÙ¶È
1CH 4 int32 ²¨ÐÎÒôƵÊý¾Ý´«ËÍËÙÂÊ
20H 2 int16 Êý¾Ý¿éµÄµ÷ÕûÊý£¨°´×Ö½ÚËãµÄ£©
22H 2   ÿÑù±¾µÄÊý¾ÝλÊý
24H 4 Char Êý¾Ý±ê¼Ç·û£¢data£¢
28H 4 int32 ÓïÒôÊý¾ÝµÄ³¤¶È
  ½â´ð£º
  ½«WAVÎļþ¸ñʽ¶¨ÒåΪ½á¹¹ÌåWAVEFORMAT£º
typedef struct tagWaveFormat
{
 char cRiffFlag[4];
 UIN32 nFileLen;
 char cWaveFlag[4];
 char cFmtFlag[4];
 char cTransition[4];
 UIN16 nFormatTag ;
 UIN16 nChannels;
 UIN16 nSamplesPerSec; ......

±à³ÌÒÕÊõ(C/C++)


1¡¢¿ìËÙ³õʼ»¯
char  *str = new [size];
str[0]='\0';
 
 
2¡¢memcpyµÄÃîÓÃ
 
ÊÔÌâ6£ºÒÑÖªWAVÎļþ¸ñʽÈçÏÂ±í£¬´ò¿ªÒ»¸öWAVÎļþ£¬ÒÔÊʵ±µÄÊý¾Ý½á¹¹×éÖ¯WAVÎļþÍ·²¢½âÎöWAV¸ñʽµÄ¸÷ÏîÐÅÏ¢¡£
  WAVEÎļþ¸ñʽ˵Ã÷±í
Æ«ÒƵØÖ· ×Ö½ÚÊý Êý¾ÝÀàÐÍ ÄÚ ÈÝ
ÎļþÍ·
00H 4 Char "RIFF"±êÖ¾
04H 4 int32 Îļþ³¤¶È
08H 4 Char "WAVE"±êÖ¾
0CH 4 Char "fmt"±êÖ¾
10H 4   ¹ý¶É×Ö½Ú£¨²»¶¨£©
14H 2 int16 ¸ñʽÀà±ð
16H 2 int16 ͨµÀÊý
18H 2 int16
²ÉÑùÂÊ£¨Ã¿ÃëÑù±¾Êý£©£¬±íʾÿ¸öͨµÀµÄ²¥·ÅËÙ¶È
1CH 4 int32 ²¨ÐÎÒôƵÊý¾Ý´«ËÍËÙÂÊ
20H 2 int16 Êý¾Ý¿éµÄµ÷ÕûÊý£¨°´×Ö½ÚËãµÄ£©
22H 2   ÿÑù±¾µÄÊý¾ÝλÊý
24H 4 Char Êý¾Ý±ê¼Ç·û£¢data£¢
28H 4 int32 ÓïÒôÊý¾ÝµÄ³¤¶È
  ½â´ð£º
  ½«WAVÎļþ¸ñʽ¶¨ÒåΪ½á¹¹ÌåWAVEFORMAT£º
typedef struct tagWaveFormat
{
 char cRiffFlag[4];
 UIN32 nFileLen;
 char cWaveFlag[4];
 char cFmtFlag[4];
 char cTransition[4];
 UIN16 nFormatTag ;
 UIN16 nChannels;
 UIN16 nSamplesPerSec; ......

c/c++Ö§³Ö¿É±ä²ÎÊýµÄº¯Êý

c/c++Ö§³Ö¿É±ä²ÎÊýµÄº¯Êý£¬¼´º¯ÊýµÄ²ÎÊýÊDz»È·¶¨µÄ¡£
Ò»¡¢ÎªÊ²Ã´ÒªÊ¹Óÿɱä²ÎÊýµÄº¯Êý£¿
Ò»°ãÎÒÃDZà³ÌµÄʱºò£¬º¯ÊýÖÐÐÎʽ²ÎÊýµÄÊýĿͨ³£ÊÇÈ·¶¨µÄ£¬ÔÚµ÷ÓÃʱҪÒÀ´Î¸ø³öÓëÐÎʽ²ÎÊý¶ÔÓ¦µÄËùÓÐʵ¼Ê²ÎÊý¡£µ«ÔÚijЩÇé¿öÏÂÏ£Íûº¯ÊýµÄ²ÎÊý¸öÊý¿ÉÒÔ¸ù¾ÝÐèҪȷ¶¨£¬Òò´ËcÓïÑÔÒýÈë¿É±ä²ÎÊýº¯Êý¡£ÕâÒ²ÊÇc¹¦ÄÜÇ¿´óµÄÒ»¸ö·½Ã棬ÆäËüijЩÓïÑÔ£¬±ÈÈçfortran¾ÍûÓÐÕâ¸ö¹¦ÄÜ¡£
µäÐ͵Ŀɱä²ÎÊýº¯ÊýµÄÀý×ÓÓдó¼ÒÊìϤµÄprintf()¡¢scanf()µÈ¡£
¶þ¡¢c/c++ÈçºÎʵÏֿɱä²ÎÊýµÄº¯Êý£¿
ΪÁËÖ§³Ö¿É±ä²ÎÊýº¯Êý£¬CÓïÑÔÒýÈëеĵ÷ÓÃЭÒ飬 ¼´CÓïÑÔµ÷ÓÃÔ¼¶¨ __cdecl ¡£ ²ÉÓÃC/C++ÓïÑÔ±à³ÌµÄʱºò£¬Ä¬ÈÏʹÓÃÕâ¸öµ÷ÓÃÔ¼¶¨¡£Èç¹ûÒª²ÉÓÃÆäËüµ÷ÓÃÔ¼¶¨£¬±ØÐëÌí¼ÓÆäËü¹Ø¼ü×ÖÉùÃ÷£¬ÀýÈçWIN32 APIʹÓÃPASCALµ÷ÓÃÔ¼¶¨£¬º¯ÊýÃû×Ö֮ǰ±ØÐë¼Ó__stdcall¹Ø¼ü×Ö¡£
²ÉÓÃCµ÷ÓÃÔ¼¶¨Ê±£¬º¯ÊýµÄ²ÎÊýÊÇ´ÓÓÒµ½×óÈëÕ»£¬¸öÊý¿É±ä¡£ÓÉÓÚº¯ÊýÌå²»ÄÜÔ¤ÏÈÖªµÀ´«½øÀ´µÄ²ÎÊý¸öÊý£¬Òò´Ë²ÉÓñ¾Ô¼¶¨Ê±±ØÐëÓɺ¯Êýµ÷ÓÃÕ߸ºÔð¶ÑÕ»ÇåÀí¡£¾Ù¸öÀý×Ó£º
//Cµ÷ÓÃÔ¼¶¨º¯Êý
int __cdecl Add(int a, int b)
{
return (a + b);
}
º¯Êýµ÷Óãº
Add(1, 2);
//»ã±à´úÂëÊÇ£º
push 2 ;²ÎÊýbÈëÕ»
push 1 ;²ÎÊýaÈëÕ»
call @Add ;µ÷Óú¯Êý¡£Æäʵ»¹ÓбàÒëÆ ......

c/c++Ö§³Ö¿É±ä²ÎÊýµÄº¯Êý

c/c++Ö§³Ö¿É±ä²ÎÊýµÄº¯Êý£¬¼´º¯ÊýµÄ²ÎÊýÊDz»È·¶¨µÄ¡£
Ò»¡¢ÎªÊ²Ã´ÒªÊ¹Óÿɱä²ÎÊýµÄº¯Êý£¿
Ò»°ãÎÒÃDZà³ÌµÄʱºò£¬º¯ÊýÖÐÐÎʽ²ÎÊýµÄÊýĿͨ³£ÊÇÈ·¶¨µÄ£¬ÔÚµ÷ÓÃʱҪÒÀ´Î¸ø³öÓëÐÎʽ²ÎÊý¶ÔÓ¦µÄËùÓÐʵ¼Ê²ÎÊý¡£µ«ÔÚijЩÇé¿öÏÂÏ£Íûº¯ÊýµÄ²ÎÊý¸öÊý¿ÉÒÔ¸ù¾ÝÐèҪȷ¶¨£¬Òò´ËcÓïÑÔÒýÈë¿É±ä²ÎÊýº¯Êý¡£ÕâÒ²ÊÇc¹¦ÄÜÇ¿´óµÄÒ»¸ö·½Ã棬ÆäËüijЩÓïÑÔ£¬±ÈÈçfortran¾ÍûÓÐÕâ¸ö¹¦ÄÜ¡£
µäÐ͵Ŀɱä²ÎÊýº¯ÊýµÄÀý×ÓÓдó¼ÒÊìϤµÄprintf()¡¢scanf()µÈ¡£
¶þ¡¢c/c++ÈçºÎʵÏֿɱä²ÎÊýµÄº¯Êý£¿
ΪÁËÖ§³Ö¿É±ä²ÎÊýº¯Êý£¬CÓïÑÔÒýÈëеĵ÷ÓÃЭÒ飬 ¼´CÓïÑÔµ÷ÓÃÔ¼¶¨ __cdecl ¡£ ²ÉÓÃC/C++ÓïÑÔ±à³ÌµÄʱºò£¬Ä¬ÈÏʹÓÃÕâ¸öµ÷ÓÃÔ¼¶¨¡£Èç¹ûÒª²ÉÓÃÆäËüµ÷ÓÃÔ¼¶¨£¬±ØÐëÌí¼ÓÆäËü¹Ø¼ü×ÖÉùÃ÷£¬ÀýÈçWIN32 APIʹÓÃPASCALµ÷ÓÃÔ¼¶¨£¬º¯ÊýÃû×Ö֮ǰ±ØÐë¼Ó__stdcall¹Ø¼ü×Ö¡£
²ÉÓÃCµ÷ÓÃÔ¼¶¨Ê±£¬º¯ÊýµÄ²ÎÊýÊÇ´ÓÓÒµ½×óÈëÕ»£¬¸öÊý¿É±ä¡£ÓÉÓÚº¯ÊýÌå²»ÄÜÔ¤ÏÈÖªµÀ´«½øÀ´µÄ²ÎÊý¸öÊý£¬Òò´Ë²ÉÓñ¾Ô¼¶¨Ê±±ØÐëÓɺ¯Êýµ÷ÓÃÕ߸ºÔð¶ÑÕ»ÇåÀí¡£¾Ù¸öÀý×Ó£º
//Cµ÷ÓÃÔ¼¶¨º¯Êý
int __cdecl Add(int a, int b)
{
return (a + b);
}
º¯Êýµ÷Óãº
Add(1, 2);
//»ã±à´úÂëÊÇ£º
push 2 ;²ÎÊýbÈëÕ»
push 1 ;²ÎÊýaÈëÕ»
call @Add ;µ÷Óú¯Êý¡£Æäʵ»¹ÓбàÒëÆ ......

OpenGL + C++ + Java


OpenGL + C++ + Java
Õâ¸ö×éºÏÓÐÒ»µãÆæ¹Ö£¬ÒòΪҪʵÏÖÔÚ
opengl
Öв¥·ÅÊÓƵ£¬ËùÒÔ²»µÃ²»ÓÐÕâÑùÆæ¹ÖµÄ×éºÏ¡£ÉϲãµÄ
MediaPlayer
·â×°µÄ»ù±¾ÉÏÊÇÕë¶Ô
android UI
µÄ¿ò¼Ü£¬Èç¹ûÏëÔÚ
opengl
ÖÐÏÔʾ£¬¹À¼ÆÄѶȺܴó¡£ÁíÍ⣬ºÜ¶à¿ªÔ´µÄ
opengl
µÄÓÎÏ·»ù±¾É϶¼ÊÇ
C++
±àд£¬ËùÒÔÕâ¸öÌåϵµÄ×÷Óû¹ÊǺܴóµÄ£¬Ö®ËùÒÔÐèÒª
java
£¬ÒòΪÉϲãµÄºÜ¶àÀýÈç´¥Ãþ¡¢ÖØÁ¦¸ÐÓ¦£¬ÕâÑùµÄ¶«Î÷£¬
android
ÊÇÒÔ
java
ʵÏֵģ¬µ×²ãµÄ¸ù±¾¿´²»µ½£¬ÕâÑùµÄ×éºÏÆðÀ´£¬³ä·ÖµÄÀûÓÃÿһ¸ö²ã´ÎµÄÓŵ㣬×î´óЧÂÊÌá¸ßÓû§ÌåÑé¡£
 
ÎÒÃÇÊ×ÏÈ»á¼òµ¥µÄ²âÊÔÒ»ÏÂ
opengl
Á¢·½ÌåÀý×Ó£¬È»ºóÎÒÃÇʵÏÖÔÚ
native
²ãÉÏÃæµÄ»æÖÆ£¬ÈçºÎʹÓÃ
jni
À´´«µÝ¡£×îºóÎÒÃǼòµ¥µÄ˵һÏÂʹÓÃ×Ô´øµÄ
android
·â×°µÄ
opengl
½Ó¿Ú
api
ÓÐʲôÑùµÄÏÞÖÆ¡£
 
Google
ÌṩµÄ
api
ÊÇ
java
µÄ
api
£¬¶ÔÓÚ
java
¿ª·¢ÕßÀ´Ëµ£¬ÕâÊǺÃÏûÏ¢£¬¶ÔÓÚ
C++
¿ª·¢ÕßÀ´Ëµ£¬¾Í»áÓкܴóµÄÂé·³¡£ÏÖÔÚÖ÷Á÷µÄÓÎÏ·ÒýÇæ¡¢ÓÎÏ·Ëã·¨»ù±¾É϶¼ÊÇ
C/C++
ʵÏÖ¡£
 
ÎÒÃÇ´¿´âÀûÓÃ
C/C++
À´Ð´
OpenGL
µÄÓ¦ÓóÌÐòµÄʱºò£¬»ù±¾Á÷³ÌÈçÏ£¬³õʼ»¯
EGL
£¬Ñ¡ÔñÅäÖã¬È»ºóÑ¡Ôñ
Display
£¬È»ºó´´½¨
Surface
£¬ ......

ÓÃVC++2005¶ÁXMLÎļþµÄСÀý×Ó

 1¡£Ð´Ò»¸öxmlÎļþ
 
 <?xml version="1.0" encoding="utf-8" ?>
- <root>
- <user id="101">
<name>abc</name>
<password>abc</password>
</user>
- <user id="102">
<name>ccc</name>
<password>ccc</password>
</user>
</root>
2¡£Ð½¨Ò»¸övc++2005¹¤³Ì ¿ÉÒÔÊǶԻ°¿ò¹¤³Ì ÒòΪֻÊǾÙÀý˵Ã÷
£¨1£©ÔÚ¶Ô»°¿òµÄ.HÎļþÌí¼Ó
#import "msxml3.dll"
using namespace MSXML2;
£¨2£©ÔÚ³õʼ»¯º¯ÊýÀïÌí¼Ó
try
{
CoInitialize(NULL);//³õʼ»¯COM×é¼þ

MSXML2::IXMLDOMDocumentPtr pDoc;
HRESULT hr=pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument)) ;//´´½¨Ò»¸öCOM½ø³Ì

if(!SUCCEEDED(hr))
{
AfxMessageBox(_T("FAILSE"),MB_OK,NULL);
}
pDoc->load("d:\\user.xml");//xmlÎļþµÄµØÖ· ÎÒ·ÅÔÚDÅÌÏÂÁË Ò²¿ÉÒÔд³ÉÏà¶ÔµØÖ·
MSXML2::IXMLDOMNodeListPtr pNodeList=NULL;//¶¨Òå½ÚµãÁбí
pNodeList=pDoc->selectNodes("root/user");//Ñ¡Ôñ½Úµã
MSXML2::IXMLDOMNodePtr pSubNode;
CString strTemp ......

ÓÃVC++2005¶ÁXMLÎļþµÄСÀý×Ó

 1¡£Ð´Ò»¸öxmlÎļþ
 
 <?xml version="1.0" encoding="utf-8" ?>
- <root>
- <user id="101">
<name>abc</name>
<password>abc</password>
</user>
- <user id="102">
<name>ccc</name>
<password>ccc</password>
</user>
</root>
2¡£Ð½¨Ò»¸övc++2005¹¤³Ì ¿ÉÒÔÊǶԻ°¿ò¹¤³Ì ÒòΪֻÊǾÙÀý˵Ã÷
£¨1£©ÔÚ¶Ô»°¿òµÄ.HÎļþÌí¼Ó
#import "msxml3.dll"
using namespace MSXML2;
£¨2£©ÔÚ³õʼ»¯º¯ÊýÀïÌí¼Ó
try
{
CoInitialize(NULL);//³õʼ»¯COM×é¼þ

MSXML2::IXMLDOMDocumentPtr pDoc;
HRESULT hr=pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument)) ;//´´½¨Ò»¸öCOM½ø³Ì

if(!SUCCEEDED(hr))
{
AfxMessageBox(_T("FAILSE"),MB_OK,NULL);
}
pDoc->load("d:\\user.xml");//xmlÎļþµÄµØÖ· ÎÒ·ÅÔÚDÅÌÏÂÁË Ò²¿ÉÒÔд³ÉÏà¶ÔµØÖ·
MSXML2::IXMLDOMNodeListPtr pNodeList=NULL;//¶¨Òå½ÚµãÁбí
pNodeList=pDoc->selectNodes("root/user");//Ñ¡Ôñ½Úµã
MSXML2::IXMLDOMNodePtr pSubNode;
CString strTemp ......
×ܼǼÊý:969; ×ÜÒ³Êý:162; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [6] [7] [8] [9] 10 [11] [12] [13] [14] [15]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ