August 01, 2003
Generalized String Manipulation: Access Shims and Type Tunneling
Listing 1: Tokenize PATH into a listbox
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());
}
Previous Page |
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
Next Page