title: Iterating over all files in OFN_ALLOWMULTISELECT with Unicode
body: <p>What is the recommended way of iterating over all files selected in an <code>OFN_ALLOWMULTISELECT</code> open file dialog with Unicode enabled?</p>
  
  <p>My first idea was something like this:</p>
  
  <pre><code>TCHAR *tmp = ofn.lpStrFile + ofn.nFileOffset;
  
  while(*tmp) {
      wprintf("Got file: %s\n", tmp);
      tmp += wcslen(tmp) + 1;
  }
  </code></pre>
  
  <p>But then it occurred to me that this won't work in case there are characters in the string buffer that can't be represented in 16 bits. So for a safe approach I'd first need to find out the byte length of the <code>tmp</code> <code>TCHAR</code> string, then cast the <code>TCHAR</code> pointer to <code>char</code> and add that byte length in each iteration. Something like this:</p>
  
  <pre><code>TCHAR *tmp = ofn.lpStrFile + ofn.nFileOffset;
  
  while(*tmp) {
      wprintf("Got file: %s\n", tmp);
      tmp = (TCHAR *) (((char *) tmp)) + get_byte_len_of_tstr(tmp));
  }
  </code></pre>
  
  <p>Note that <code>get_byte_len_of_tstr()</code> is just a placeholder for a function that would've to be written for this purpose. Since this approach looks somewhat clumsy, I'd first like to ask for some feedback whether this is really the way to go or whether I've missed or misunderstood something here...</p>