digitalmars.D.learn - Is there any bettter solution to Windows wide string
- Vinod K Chandran (8/8) May 08 2021 Hi all,
- Imperatorn (2/10) May 08 2021 iirc that's toUTF16z
- Vinod K Chandran (2/3) May 08 2021 Thanks. Let me check. :)
- FreeSlave (6/14) May 09 2021 You may try using tempCStringW from std.internal.cstring. It uses
- Vinod K Chandran (2/7) May 09 2021 Thanks for the reply. Let me check. :)
Hi all, I am planning some win32 hobby projects. Now I have this function to tackle the LPCWSTR data type in win32. ```d private import std.utf; auto toWString(S)(S s) { return toUTFz!(const(wchar)*)(s); } ``` Is there any better way to do this ?
May 08 2021
On Saturday, 8 May 2021 at 20:50:10 UTC, Vinod K Chandran wrote:Hi all, I am planning some win32 hobby projects. Now I have this function to tackle the LPCWSTR data type in win32. ```d private import std.utf; auto toWString(S)(S s) { return toUTFz!(const(wchar)*)(s); } ``` Is there any better way to do this ?iirc that's toUTF16z
May 08 2021
On Saturday, 8 May 2021 at 21:26:06 UTC, Imperatorn wrote:iirc that's toUTF16zThanks. Let me check. :)
May 08 2021
On Saturday, 8 May 2021 at 20:50:10 UTC, Vinod K Chandran wrote:Hi all, I am planning some win32 hobby projects. Now I have this function to tackle the LPCWSTR data type in win32. ```d private import std.utf; auto toWString(S)(S s) { return toUTFz!(const(wchar)*)(s); } ``` Is there any better way to do this ?You may try using tempCStringW from std.internal.cstring. It uses small string optimization. However the api is internal, so I'm not sure how valid it is to use this function. The returned struct is a temporary buffer so you must ensure that you don't escape dangling pointers.
May 09 2021
On Sunday, 9 May 2021 at 09:34:00 UTC, FreeSlave wrote:You may try using tempCStringW from std.internal.cstring. It uses small string optimization. However the api is internal, so I'm not sure how valid it is to use this function. The returned struct is a temporary buffer so you must ensure that you don't escape dangling pointers.Thanks for the reply. Let me check. :)
May 09 2021