Re: CCcomBSTR to vector<DWORD> by ama
ama
Sat Jun 10 11:17:49 CDT 2006
>>[VC++ 6]
>>
>>I receive values from an another application as a com string:
>>"234,454,567,5676756, etc... "
>>
>>And i need to store the values as DWORDs in an array,
>>preferably a vector<DWORD> .
>>
>>What would be the faster way of doing this ?
>
> I'd probably do something like this:
>
> #include <atlstr.h>
>
> CComBSTR myBstr;
> vector<DWORD> myVector;
> CAtlStringW str = myBstr;
> int curPos;
>
> for(
> CAtlStringW token = str.Tokenize( ",", curPos );
> curPos >= 0;
> token = str.Tokenize( ",", curPos )
> )
> {
> myVector.push_back( wcstoul( token, NULL, 10 ) );
> }
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
awesome, thanks for the tip