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 ;µ÷Óú¯Êý¡£Æäʵ»¹ÓбàÒëÆ÷ÓÃÓÚ¶¨Î»º¯ÊýµÄ±í´ïʽÕâÀï°ÑËüÊ¡ÂÔÁË
add esp,8 ;µ÷ÓÃÕ߸ºÔðÇåÕ»
Èç¹ûµ÷Óú¯ÊýµÄʱºòʹÓõĵ÷ÓÃÐÒéºÍº¯ÊýÔÐÍÖÐÉùÃ÷µÄ²»Ò»Ö£¬¾Í»áµ¼ÖÂÕ»´íÎó£¬ÕâÊÇÁíÍâÒ»¸ö»°Ì⣬ÕâÀï²»ÔÙϸ˵¡£
ÁíÍâc/c++±àÒëÆ÷²ÉÓúêµÄÐÎʽ֧³Ö¿É±ä²ÎÊýº¯Êý¡£ÕâЩºê°üÀ¨va_start¡¢va_argºÍva_endµÈ¡£Ö®ËùÒÔÕâô×ö£¬ÊÇΪÁËÔö¼Ó³ÌÐòµÄ¿ÉÒÆÖ²ÐÔ¡£ÆÁ±Î²»Í¬µÄÓ²¼þƽ̨Ôì³ÉµÄ²îÒì¡£
Ö§³Ö¿É±ä²ÎÊýº¯ÊýµÄËùÓк궼¶¨ÒåÔÚstdarg.h ºÍ varargs.hÖС£ÀýÈç±ê×¼ANSIÐÎʽÏ£¬ÕâЩºêµÄ¶¨ÒåÊÇ£º
typedef char * va_list; //×Ö·û´®Ö¸Õë
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
#define va_end(ap) ( ap = (va_list)0 )
ʹÓúê_INTSIZEOFÊÇΪÁË°´ÕÕÕûÊý×Ö½Ú¶ÔÆëÖ¸Õ룬ÒòΪcµ÷ÓÃÐÒéÏÂÃ棬²ÎÊýÈëÕ»¶¼ÊÇÕûÊý×Ö½Ú£¨Ö¸Õë»òÕßÖµ£©¡£
Èý¡¢ÈçºÎ¶¨ÒåÕâÀàµÄº¯Êý¡£
¿É±ä²ÎÊýº¯ÊýÔÚ²»Í¬µÄϵͳÏ£¬²ÉÓò»Í¬µÄÐÎʽ¶¨Òå¡£
1¡¢ÓÃANSI±ê×¼ÐÎʽʱ£¬²ÎÊý¸öÊý¿É±äµÄº¯ÊýµÄÔÐÍÉùÃ÷ÊÇ£º
type funcname(type para1, type para2, …);
Ïà¹ØÎĵµ£º
Ê×ÏÈ¿´ÏÂÏÂÃæÕâ¶Î£º
int main()
{
char *name = "fengkewei";
char name1[] = "fengkewei";
char *name2 = "fengkewei";
char *name3 = "woaifengkewei";
int i = 10;
int j = 10;
int k = 11;
return 0;
}
ÈôÄú¾õµÃËüÃÇÓ¦¸Ã¶¼±£´æÔÚÄÚ´æÖеÄÒ»¿éµØ·½£¬ÄÇÇëÍùÏ¿´¡£¡£¡£¡£
ÏÂÃæÊDZàÒëÆ÷Ϊ¸÷¸ö±äÁ¿·ÖÅäµÄÄÚ´æµØ ......
ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
<name>¹þÀï²¨Ì ......
freadº¯ÊýºÍfwriteº¯Êý
1.º¯Êý¹¦ÄÜ
ÓÃÀ´¶Áдһ¸öÊý¾Ý¿é¡£
2.Ò»°ãµ÷ÓÃÐÎʽ
fread(buffer,size,count,fp);
fwrite(buffer,size,count,fp);
3.˵Ã÷
£¨1£©buffer£ºÊÇÒ»¸öÖ¸Õ룬¶ÔfreadÀ´Ëµ£¬ËüÊǶÁÈëÊý¾ÝµÄ´æ·ÅµØÖ·¡£¶ÔfwriteÀ´Ëµ£¬ÊÇÒªÊä³öÊý¾ÝµÄµØÖ·¡£
£¨2£©size£ºÒª¶ÁдµÄ×Ö½ÚÊý ......
(ת)C/C++ÖеÄÈÕÆÚºÍʱ¼ä time_tÓëstruct tmת»»
ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê ......