Listing 1: Tokenize PATH into a listbox
typedef std::string string_t;
typedef stlsoft::string_tokenizer < string_t
, char
, ...> tokenizer_t;
// Tokenize the PATH contents, with ; as the separator
tokenizer_t tokens(winstl::environment_variable<char>("PATH"), ';');
HWND hwndList = ::GetDlgItem(. . .);
// Iterate sequence, place each element in list control
tokenizer_t::const_iterator begin = tokens.begin();
tokenizer_t::const_iterator end = tokens.end();
for(; begin != end; ++begin)
{
// Add the item to the result ...
const string_t &s(*begin);
ListBox_AddString(hwndList, s.c_str());
}