returns a const char and not a char ? And why can I still modify the return value if it's a const?
How does the CkHttp_quickGetStr handle internally the result from the HTTP request? Does it dynamically allocate memory for the response and it gets deallocated by calling CkHttp_Dispose(...)?
asked Oct 23 '15 at 11:01
I assume this is for "C" programming?
Any method that returns a string has 2 forms. The lowercase form returns a "const char *" to internal memory. The uppercase form deposits the string in the CkString object that is passed in the last argument.
BOOL CkHttp_QuickGetStr(HCkHttp cHandle, const char *url, HCkString outStr);
The uppercase form might be used like this:
HCkString strObj; HCkHttp http; BOOL success; const char *html;
If using the lowercase form, then be sure to use the string pointed to by the returned "const char *" before the CkHttp object is disposed, and before calling other methods. (Actually, you can call up to 10 methods before the least recent "const char *" is recycled.) If your app needs to keep a copy of the string, it should strcpy it to somewhere else. (or you can use the uppercase version of the method and just keep the strObj around..)