c++ - Declaring char[][512]? -


I have a C ++ SDK for which one paragraph [] [512] is required as a parameter I know That this file is considered to be a list of names and the number of files may vary. For my life I can not tell how to declare it. I have an array of CSTRing and I am trying to copy them using Structus_s and then passing them in SDK. Any ideas on how to do this?

This announcement has a special meaning when the parameter of one declares the function. Within the parameter list it is equivalent to char [100] [512] , char [123] [512] , char [3] [512] (you get this idea - the first size can only be anything, it is only ignored) and also for char (*) [512] . Effectively, it will accept as a logic with a flexible (arbitrarily) first shape as a 2D array.

You can actually declare an array passing the function with the first size of the concrete, for example

  four names [3] [512] = {"Abc", "cde", "fgh"};  

If you know the first shape at the time compilation of time, then surely.

If the first size is known only on run time (eg, n ), then you have to allocate the array dynamically

  char (* Name) [512] = new four [n] [512]; // Now fill it with names  

or, more beautiful, with a type of typed

  typedef char TName [512]; TName * names = new TName [n]; // Now fill it with names  

I hope that the SDK function you are talking about should also give you another parameter as the first size of the name array. Tells for


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -