ImGui::ListBox getting ? on strings


#1

Why does this code output ??? it should only display the file path of the video and if it’s currently playing in a listbox but when I use strings as the source of data.

 //  char** videobox_items = 0;    
temp = std::string("[Playing] " + player_time + " " + std::string(video_box_list[i].file_url_name));
videobox_items[i] = (char*) temp.c_str();

  ImGui::ListBox(" ", &videobox_item_current_1, videobox_items,
                    last_videobox_item, 4);
                   

#2

Code is missing so it’s hard to tell.

Anyway you can/should use ListBoxFooter/ListBoxHeader then you can output your items directly without fitting through the more limited and old ListBox() API.


#3

I’ll try it out, thanks for the tip


#4

I fixed it.
Turns out I was assigning char to string without first resizing the char * to match the strings size.