I'm currently developing a code in c++ and to be more "C++", I'm moving my char \* to string.

By the way, I do have some issues to assign the value. 

My code is crashing as soon as I am assigning a str to the std::string.

Here is the code.

```
    std::string str;

    std::cout << "Friendly\n";
    str.assign(LIBMTP_Get_Friendlyname(PulsDeviceMngr->device));
    if(str.empty())
        PulsDeviceMngr->devicename = "Not Defined";
    else {
        PulsDeviceMngr->devicename = str ;
        str.clear();
    }

```

I have also try to replace:

```
    str.assign(LIBMTP_Get_Friendlyname(PulsDeviceMngr->device));

```

by

```
    str = LIBMTP_Get_Friendlyname(PulsDeviceMngr->device);

```

LIBMTP\_Get\_Friendlyname can return NULL is there is not Friendlyname defined.

I'm lost.. it's the first time I'm using the string under c++
thx for your help