in the line: ((string*)userp)->append((char*)contents, size * nmemb);
Why use (char*)
or (string*)
as opposed to char*
or string
? Trying to use char*
or string
results in an error Also, what does the operator ->
do? It seems like it is just taking the place of str.append(var, pos);
(string*) is a cast to pointer to string and string is a class string. (char*) is a cast to pointer to char and char* is a pointer to char. the -> operator accesses the attributes or methods of a pointer to a class
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.