Miguel,
> Thanks, this is the way it works. But now, I have another problem. I´m
> calling a function in an API, that have the next signature:
>
> void function1(out std::string* version);
>
> If I debug and see the value in the Watch window, I see the next version
> returned value:
>
>         version
>                _Bx
>                 [+] _Buf
>                [+] _Ptr  <- The function return the value here
>
> When I call version.c_str(), I obtain a pointer to the buf, that is like
> a char[], but not to the ptr where the function copies the data.

You're not quite right. It's just that the std::strng implementation on
VC++.NET is quite different. Now, it uses a union between a char[16] and a
char*. If the string it holds is less than 15 chars in length, it's held in
the char array in-place, saving an allocation. Only if it's larger will an
external buffer be allocated on the heap and a pointer to it stored in _Ptr.
Regardless of that, you can be sure string::c_str() will return a pointer to
the actual storage of the string.

--
Tomas Restrepo
[EMAIL PROTECTED]

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to