18.05.2013, 20:43
What's wrong with NULL terminating a string and use strcat to make it look like strcpy. I've actually tested this macro...
Edit:
Edit:
pawn Код:
new buffer[128] = "";
__strcat_(buffer, "Test __strcat_");
print(buffer);
strncat(buffer, "Test strncat", 12);
print(buffer);
printf("First 's' at %d", strchr(buffer, 's'));
printf("Last 's' at %d", strrchr(buffer, 's'));
printf("__strcmp_ result: %d", __strcmp_("foo", "Foo"));
printf("strncmp result: %d", strncmp("foo", "Foo", 2));
printf("strcasecmp result: %d", strcmp("foo", "Foo"));
printf("strncasecmp result: %d", strncasecmp("foo", "Foo", 2));
strcpy(buffer, "Test strcpy");
print(buffer);
strncpy(buffer, "Test strncpy", 12);
print(buffer);
print(strpbrk(buffer, {'s', 't', 'c'}));
printf("strspn %d", strspn(buffer, {'s', 't', 'c'}));
printf("strspn %d", strcspn(buffer, {'s', 't', 'c'}));
printf("strstr %d", strstr(buffer, "Test"));
printf("strcasestr %d", strstr(buffer, "Test"));
Код:
[22:45:40] Test __strcat_ [22:45:40] Test strncat [22:45:40] First 's' at 3 [22:45:40] Last 's' at 6 [22:45:40] __strcmp_ result: 1 [22:45:40] strncmp result: 1 [22:45:40] strcasecmp result: 1 [22:45:40] strncasecmp result: 0 [22:45:40] Test strcpy [22:45:40] Test strncpy [22:45:40] ssttcssttrsspn [22:45:40] strspn 9 [22:45:40] strspn 3 [22:45:40] strstr 0 [22:45:40] strcasestr 0