Copy string
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
enums are like defines - in fact they're almost identical:

pawn Код:
#define E_1 0
#define E_2 1
#define E_3 5
#define E_E 6
new arr[E_E];
pawn Код:
enum E_E
{
    E_1,
    E_2[4]
    E_3
}
new arr[E_E];
There are still multidimensional arrays, so why can't I call an array in an array?

pawn Код:
enum mJob {
    mID,
    mCargo[50],
    mTrailer,
    Float:mTrailerX,
    Float:mTrailerY,
    Float:mTrailerZ,
    Float:mTrailerA,
    mCompanyFrom,
    mCompanyTo,
    mValue
};
pawn Код:
enum playerInfo {
    mCurrentJob[mJob]
} // all other variables omitted for the sake of clarity
Why doesn't this work?

I get your defines way, but I can still redefine everything, even parts of an array.

Edit: OK, so I tried to put it outside the enum and make it like any other enum. I replaced my code with this:
pawn Код:
currentJob[playerid][mCargo] = jobs[playerid][jobid][mCargo];
        printf("%s", currentJob[playerid][mCargo]);
        printf("%s",jobs[playerid][jobid][mCargo]);
But it still only prints 1 character, whilst the second calling works just fine. I really don't understand why.

I tried to copy it with memcpy, as suggested as well, but all that did was give me an empty string (just like strmid btw)
Reply


Messages In This Thread
Copy string - by mamorunl - 02.02.2013, 17:11
Re: Copy string - by T0pAz - 02.02.2013, 17:16
Re: Copy string - by mamorunl - 02.02.2013, 17:44
Re: Copy string - by T0pAz - 02.02.2013, 17:48
Re: Copy string - by mamorunl - 02.02.2013, 17:49
Re: Copy string - by mamorunl - 02.02.2013, 17:57
Re: Copy string - by mamorunl - 02.02.2013, 19:30

Forum Jump:


Users browsing this thread: 1 Guest(s)