Hi,
I'm trying to build a plugin for Rainmeter and I'm stuck.
I have a function called ephemeride(), which return a std::wstring.
What I want to do with this wstring is to print it on my skin but when I "fetch" the wstring and put it in the value member of my Measure struct, all I get on the skin is three random characters. They sometimes changes when the skin updates.
I checked the values in rainmeter's log, the wstring from ephemeride() is ok since it has the correct length, but when I check the content, it's only 3 characters (as shown on my skin)
I attached three screenshots, the skin on my desktop, the log from rainmeter and the code of my plugin
Thanks for your help, I really need it ^^
It is currently October 13th, 2024, 1:59 am
I need help with std::wstring
-
- Posts: 2
- Joined: April 12th, 2022, 9:20 pm
I need help with std::wstring
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 2738
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: I need help with std::wstring
The RmLogF functions basically wrap around the printf function. The %s specifier wants a "C string", so you have use the raw C-style string instead of std::wstring.
So, try text.c_str() instead of just text in the _snwprintf_s and RmLogF function calls.
-Brian
So, try text.c_str() instead of just text in the _snwprintf_s and RmLogF function calls.
-Brian
-
- Posts: 2
- Joined: April 12th, 2022, 9:20 pm
Re: I need help with std::wstring
I wan't to die when I think I tried to find the problem for 4 hours and it was so simple
Thanks a lot buddy, it works fine now !
Thanks a lot buddy, it works fine now !