Which macro is correct for strcpy?
#1

What is correct macro for strcpy? In YSI (y_utils) I can see:

pawn Код:
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
But here on forums I found:

pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
What is difference?
Reply
#2

The second is the correct because you have to specify the max length. If you try the first one with an array from an enum, it will be NULL.
Reply
#3

Would much rather wrap it in a function so the third argument can have a default sizeof expression. This allows both versions to be used. I never quite understood the obsession with macros anyway.
Reply
#4

Okay, thanks ****** now I understand.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)