C++ How to use and pass a 3-dimensional char array? -


I am trying to create a four array to store the return value of a function. The data in the following functions is stored in ***** Velava **. How to access data to create an extract variable?

  int credis_lrange (REDIS rhnd, const char * key, int start, int end, char *** valv) {int rc; If ((RC = CRD & FNDRESAV (R & D, CRMT, "LRANGE% s% d% d \ r \ n", key, start, end)) == 0 * {* valve = R & D-> GTM R.C. = R & B-> North. MultiBulle. Lan; } Return RC; }  

Solution:

  Four ** element; Int size = credis_lrange (it-> redis, "object_2", 600,603, and element); For (Int i = 0; I  

Thanks to all!

  four * ** element [size];  

Actually does not have a 3D array, but the elements of char are not elements of pointers to pointers-to-pointers. is .

Use one of the following:

  Four E [D1] [D2] [D3]; / * D1, D2, D3 integral constant * / four * E [D2] [D3]; Four E [] [D2] [D3];  

In addition, you can pass it on the criteria of e as a logic for your work only.

Upon further reading, it appears that the parameter is not actually a 3D array, but there is an indicator for an array of C-style strings. Note, syntax can be the same, the intention is different.

In that case, you will need to do two things:

  • Specify the number of stars
  • For each string
      < Li> Copy the string data on the allocated memory
    • char array

And finally, Going to the credis_lrange function on this array address.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -