What do you expect to find? The string your searching in is "wstring httpResponseHeader" and you're searching for "Content=" which is not part of that string. Then you store the result of the find member function in the variable
found
. Note that this value is a position value, and in this case will return the predefioned constant
string::npos
(which by the way is not equal to 0).
The reason you don't see any useful result from your
printf
statement however is entirely different: you provide a format string that expects a variable of type string (format specifier %s), but you provide a value of type size_t, which of course doesn't fit. Unfortunately printf does not (and in fact can not) do any type check, so it tries to convert
string::npos
into a char pointer, which of course results in something unexpected. Ahhh, the wonders of type-unsafe C functions...
If you want some type-safe output, use iostrem, like this:
#include <iostream>
std::cout << std::endl << "find result: " << found << std::endl;
Note:
std::endl
is the equivalent of a line break; the main difference to '\n' is that it is guaranteed to work on any operating system, inlcuding those that require an additional '\r' (carriage return).
P.S.: check this out:
http://www.cplusplus.com/reference/string/string/find/[
^]