#include <stdio.h>
char* m_cpy(char* a, char* b)
{
char* rb = b;
_asm
{
mov edi, a
lea esi, b
L2:
cmp byte ptr [esi], 0x00
je L1
mov [esi], byte ptr [edi]
inc esi
inc edi
jmp L2
L1:
mov byte ptr [esi], 0x00;
}
return rb;
}
int main()
{
char* str1 = "Hello i2sec";
char str2[20];
char* tmp = NULL;
printf("str2 : %s \n", str2);
tmp = m_cpy(str1,str2);
printf("tmp : %s\n", tmp);
printf("str2 : %s\n", str2);
printf("tmp Addr : %p\nstr2 : %s\n", tmp,str2);
return 0;
}
ÀÌ·¸°Ô ´µ¥
inc esi ºÎºÐ¿¡¼ ¿¡·¯°¡ ³ª´Âµ¥...ÀÌÀ¯°¡ ¹º°¡¿ä??
|