Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- //#include <string.h>
- char* _strcpy(char* _s, const char* _d);
- char sz1[99] = "SONY ",
- sz2[99] = "Pictures 222";
- ////////////////////////////////////////////////////
- int main()
- {
- printf("sz1 = %s \n", sz1);
- char *p =_strcpy(sz1, sz2);
- printf("1address p = %d \n ", &p);
- printf("sz1 = %s \n ", p);
- return 0;
- }
- /////////////////////////////////////////////////////////
- char* _strcpy(char *s1, const char *s2)
- {
- int i = 0;
- char *p = s1;
- printf("2address p = %d \n ", &p);
- while(s2[i])
- {
- s1[i] = s2[i];
- i ++;
- }
- s1[i] = 0;
- return p;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- #include <stdio.h>
- #include <string.h>
- char* _strcpy(char* _s, const char* _d);
- char sz1[99] = "SONY ",
- sz2[99] = "Pictures_982143";
- ////////////////////////////////////////////////////
- int main()
- {
- char *psz2 = _strcpy(sz1, sz2);
- printf("sz1 = %s \n ", psz2);
- return 0;
- }
- /////////////////////////////////////////////////////////
- char* _strcpy(char *_s1, const char *_s2)
- {
- __asm // - - - - - - - - - - - - -
- { mov esi, _s2
- mov edi, _s1
- mov ebx, _s1
- L_01: mov al, [esi]
- mov [edi], al
- or al, 0
- jz L_02
- inc esi
- inc edi
- jmp L_01
- L_02: mov eax, ebx
- }; // - - - - - - - - - - - - -
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement