[Gambas-devel] Net - new interface

Benoit Minisini gambas at ...1...
Sun Jan 18 19:16:03 CET 2004


On Saturday 17 January 2004 22:00, Daniel Campos wrote:
> Hi Benoît:

Hi, Daniel,

>
>  1) As a part of the new Net interface, I would like to
> return headers of Http request as an array of strings
> instead of a whole string, something like the new Dir()
> function, as usually, when a programmer needs to read
> the contents of header from server, he/she needs to
> split the header as each line contains different information.
>
>
> HttpClient.Header As String[]
>
>  The problem is that I don't know at all how to return
> an array of strings, I've look at the sources and documentation
> but I don't find it.
>
> Regards,
>
> Daniel Campos

Here is an example:

--8<------------------------------------------------------------

GB_ARRAY garray; /* array object */
char **header; /* HTTP header as char *[] */
int size; /* array size, i.e. line count of header*/
char *str;
int i;

GB.Array.New(&garray, GB_T_STRING, size);

for (i = 0; i < size; i++)
{
  GB.NewString(&str, header[i], 0); /* Create a gambas string */
  *((char **)GB.Array.Get(garray, i)) = str; /* store it in the array */
}

return garray;

--8<------------------------------------------------------------

The documentation is not up to date.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...





More information about the Devel mailing list