[Help] Passing an array of strings.
#9

I believe this is possible but as ****** mentioned the one-at-a-time method may be better for your purpose as you don't know how many files there are in the specified directory in advance.

Anyway, there's a section in their Implementer's Guide document and here's what it states about the subject at page 61:

Quote:

Multi-dimensional arrays must be handled differently, though, as the memory
lay-out differs between C/C++ and pawn. In comparison with C/C++, two-
dimensional arrays in pawn are prefixed with a single-dimensional array that
holds memory offsets to the start of each “row” in the two-dimensional array.
This extra list allows each row to have a different column length. In C/C++, each
column in a two-dimensional array must have the same size.

If you are writing a wrapper function for an existing C function, as opposed to
writing/adapting a native function specifically to exploit pawn’s features, you will
not be concerned with variable column-length arrays —C/C++ does not support
them, so your native function will not allow them. All that needs to be done,
then, is to skip the prefixed “column offsets” list after getting the address from
amx_GetAddr.

For an example, I use the OpenGL function glMultMatrixf which multiplies a
given 4 Ч 4 matrix with the current matrix. The prototype of the function is:

Код:
void glMultMatrixf(const GLfloat *m);
The wrapper function just has to get the address of its array parameter and add
four cells to them.

Код:
static cell n_glMultMatrixf(AMX *amx, const cell *params)
{
  cell *cptr;
  assert(sizeof(cell) == sizeof(time_t));
  amx_GetAddr(amx, params[1], &cptr);
  glMultMatrixf( (GLfloat*)(cptr + 4) );
  return 0;
}
Reply


Messages In This Thread
[Help] Passing an array of strings. - by N1trO - 17.05.2011, 06:31
Re: [Help] Passing an array of strings. - by H1g0r - 17.05.2011, 11:44
Re: [Help] Passing an array of strings. - by N1trO - 17.05.2011, 12:54
Re: [Help] Passing an array of strings. - by Gamer_Z - 17.05.2011, 13:27
Re: [Help] Passing an array of strings. - by RyDeR` - 17.05.2011, 15:15
Re: [Help] Passing an array of strings. - by N1trO - 17.05.2011, 18:36
Re: [Help] Passing an array of strings. - by N1trO - 18.05.2011, 16:47
Re: [Help] Passing an array of strings. - by RyDeR` - 18.05.2011, 18:02
Re: [Help] Passing an array of strings. - by 0x5A656578 - 21.05.2011, 08:26

Forum Jump:


Users browsing this thread: 1 Guest(s)