Angus Leeming <[EMAIL PROTECTED]> writes:

| Given this, which is MacOS X code to fill 'application_support':
>
|     unsigned char application_support[PATH_MAX + 1];
|     OSStatus const status_code =
|         FSRefMakePath(&fsref, application_support, PATH_MAX);
>
| what's the correct way to create a std::string?
>
|     std::string(application_support) fails.

Do you know its length?

   std::string(application_support, application_support + length);

??

| error: invalid conversion from `unsigned char*' to `const char*'

Hmm... bad type to return imho.

otoh... why is applicaton_support unsigned char in the first place?

what happens if you make it just char[]?

| I think that it's safe to cast, but am I correct?
>
|     std::string(reinterpret_cast<char const *>(application_support));

We should try to avoid it.


-- 
        Lgb

Reply via email to