0

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 stringresults in an error Also, what does the operator -> do? It seems like it is just taking the place of str.append(var, pos);

Cameron346
  • 21
  • 3
  • 6
    With respect, questions like "what does `->` do?" are best answered by reading any [introductory book on C++](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list)... – Oliver Charlesworth Nov 28 '13 at 23:16

1 Answers1

2

(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

Wilson Junior
  • 96
  • 2
  • 7