COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 11-22-2018, 02:24 AM   #1
Yomi
Human being with feelings
 
Join Date: Nov 2016
Posts: 2
Default Convert a WDL_String into std::string

I'm trying to convert a WDL_String from the IFileSelectorControl into a std::string to send it to a function from an external library.
I've tried the suggestion from this thread https://forum.cockos.com/showthread.php?t=173135
Code:
WDL_String filePath;
std::string filePathStr;

mFileDialog->GetLastSelectedFileForPlug(&filePath);

filePathStr = filepath.Get();
But nothing is seems to pass to filePathStr.
How can I make this conversion?
Yomi is offline   Reply With Quote
Old 11-22-2018, 06:10 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,554
Default

Have you checked the file dialog method properly sets the WDL_String to a valid string?
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 11-22-2018, 06:54 AM   #3
Yomi
Human being with feelings
 
Join Date: Nov 2016
Posts: 2
Default

It turns out I had to use a const char* instead of a string.
Code:
WDL_String filePath;
const char *filePathStr;

mFileDialog->GetLastSelectedFileForPlug(&filePath);

filePathStr = filepath.Get();
working fine now.
Yomi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.