All pastes #486816 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-14 02:20 UTC
rendered paste body
Code Snippet:
const char ** FTportSelectionDialog::getSelectedPorts()
{
        int n = _selectedPorts.GetCount();
        const char ** pnames = (const char **) malloc(sizeof(char*) * n+1);

        for (int i=0; i < n; i++) {
                //pnames[i] = wxString(_selectedPorts.Item(i)->GetData()).mb_str();
                pnames[i] = (const char *)wxConvCurrent->cWX2MB(_selectedPorts.Item(i)->GetData());
                printf("pname: ]%s[\n", pnames[i]);
                printf("test1: ]%s[\n", _selectedPorts.Item(i)->GetData());
                printf("test2: ]%s[\n",
                        (const char *)wxConvCurrent->cWX2MB(_selectedPorts.Item(i)->GetData()));
        }
        pnames[n] = NULL;

        // must be deleted by them
        return pnames;
}

Output:
pname: ] 7&#65533;[
test1: ]a[
test2: ]alsa_pcm:capture_1[
pname: ] 7&#65533;[
test1: ]a[
test2: ]alsa_pcm:capture_2[