C³ÌÐòʹÓò»Í¬º¯Êýµ÷ÓÃÔ¼¶¨µ÷Óûã±à×Ó¹ý³Ì
ÈçתÔØ£¬Çë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/zhangyang0402/archive/2010/05/01/5549266.aspx
¿ª·¢¹¤¾ß£ºVC ++ 6.0 MASM32
Ò»¡¢__cdeclµ÷Ó÷½Ê½
1£® ÔÚVCÖÐн¨Win32 Console Application, TestASM
2£® н¨test.c
#include<stdio.h>
extern void swap(int *px, int *py);
int main(void)
{
int a=1, b=2;
printf("before swaping, a=%d, b=%d\n", a, b);
swap(&a, &b);
printf("after swaping, a=%d, b=%d\n", a, b);
return 0;
}
3£® ʹÓÃUltraEdit±à¼»ã±à³ÌÐòswap.asm
.386
.MODEL FLAT, C
OPTION CASEMAP:NONE
.CODE
swap PROC a:DWORD, b:DWORD
PUSH ESI
PUSH EDI
MOV ESI, [EBP+8]
MOV EAX, [ESI] ;²ÎÊý1µÄÖµ->EAX
MOV EDI, [EBP+12]
XCHG EAX, [EDI]
MOV [ESI], EAX
POP EDI
POP ESI
RET
swap ENDP
END
4£® ½«swap.asmÌí¼Óµ½TestASM¹¤³ÌÖÐ
VC->Project->Add to project->Files, ÎļþÀàÐÍÑ¡Ôñ“ËùÓÐÎļþ”£¬Ñ¡Öлã±àÔ´Îļþswap.asm²¢Ìí¼Óµ½¹¤³Ì
»òÖ±½Ó±àÒëswap.asm£¬½«Éú³ÉµÄswap.obj¿½±´µ½¹¤³ÌĿ¼ÏÂ
5£® ÔÚVCÖÐÉèÖûã±à³ÌÐò±àÒëÑ¡Ïî
ÔÚVCµÄFileViewÖУ¬ÓÒ»÷swap.asm->Settings, Çл»µ½“Custom Build”Ñ¡Ï£¬
ÔÚ“Command”ÖÐÊäÈ룺ml /c /coff $(InputName).asm£¬
“Output”ÖÐÊäÈë £º$(InputName).obj
6£® ±àÒëÁ´½ÓÖ´ÐÐ
Ë«»÷test.c->Compile£¬ Éú³Étest.obj
Ë«»÷swap.asm->Compile£¬ Éú³Éswap.obj
È»ºóBuild£¬ Éú³ÉTestASM.exe
×îºóÖ´ÐÐ
½á¹ûÈçÏÂ:
before swaping, a=1, b=2
after swaping, a=2, b=1
Press any key to continue
¶þ¡¢__stdcallµ÷Ó÷½Ê½
1.CÔ´³ÌÐò
#include<stdio.h>
extern
Ïà¹ØÎĵµ£º
ÀûÓÃc.vim²å¼þ£¬Äã¿ÉÒÔʵÏÖ
Ìí¼ÓÎļþÍ·
Ìí¼Ó×¢ÊÍ
²åÈëһЩ´úÂëƬ¶Î
Óï·¨¼ì²é
¶Áº¯ÊýÎĵµ
×¢ÊÍ´úÂë¿é
ÕâÒ»²å¼þµÄ×÷ÕßÊÇ Fritz Mehner, Ä¿±ê¾ÍÊÇ´òÔì³ÌÐòÔ±Á÷³©µÄ±à¼»·¾³¡£
ÕâÒ»²å¼þ»¹ÄÜÍê³É:
Statement oriented editing of C / C++ programs
Speed up writing new code considerably.
Write code and ......
#include<stdio.h>
#include<malloc.h>
#include<string.h>
/*
* ·×ª
*/
char *mystrrev(char *arr)
{
if (!arr)
{
return NULL;
}
char *temp = arr;
char t;
int leng = strlen(arr) + 1;
int l = (int)(leng / 2);
int i = 0;
while (l--)
{
t = arr[i];
arr[ ......
Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí±ß»¹Ò»Ö±³äÂúÕ ......
ÐÞ¸Ämakefile£¬ÔÚLIBSÀïÃæ¼ÓÉÏ-lmemcached£¬±ÈÈçÔÀ´ gcc test.c£¬ÏÖÔÚ gcc test.c -lmemcached¡£Õâ¸ö¿â¾ÍÊÇlibmemcachedÌṩµÄ¡£
È»ºóÌí¼Ó#include<libmemcached/memcached.h>£¬Õâ¸öÎļþÒ²ÊÇlibmemcachedÌṩµÄ¡£
Ö÷º¯ÊýÀïÃæÐèÒªÌí¼Ó£º
memcached_st *memc;
uint32_t&nbs ......
CÓïÑÔÖÐÓм¸¸ö»ù±¾ÊäÈ뺯Êý£º
//»ñÈ¡×Ö·ûϵÁÐ
int fgetc(FILE *stream);
int getc(FILE *stream);
int getchar(void);
//»ñÈ¡ÐÐϵÁÐ
char *fgets(char * restrict s, int n, FILE * restrict stream);
char *gets(char *s);//¿ÉÄܵ¼ÖÂÒç³ö£¬ÓÃfgets´úÌæÖ®¡£
//¸ñʽ»¯ÊäÈëϵÁÐ
int fscanf(FILE * r ......