LibXL - How to convert GS::UniString to wchar_t *?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-10-19
07:08 PM
- last edited on
2021-09-14
01:42 PM
by
Noemi Balogh
2020-10-19
07:08 PM
Hi,
I'm looking at the Database_Control example for Archicad 23 and I see that the example shows using a define to convert:
Thanks
I'm looking at the Database_Control example for Archicad 23 and I see that the example shows using a define to convert:
UNISTR_TO_LIBXLSTR(str) (str.ToUstr ()), however I cannot get the example or my own project to build when following this code. I get an error that
no suitable conversion function from "GS::UniString::UStr" to "const wchar_t *" existsC/C++(413), is this example not up to date or is there some other way to convert the GS::UniString to the correct type for the excel library?
Thanks
Labels:
- Labels:
-
Add-On (C++)
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-10-19 09:38 PM
2020-10-19
09:38 PM
Which compiler, version and toolset are you using?
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-11-04 07:17 PM
2020-11-04
07:17 PM
I was able to convert a UniString to a wstring in C++ using:
(str is a GS::UniString)
(str is a GS::UniString)
GS::UniChar::Layout* valptr = str.CopyUStr(0, str.GetLength()); wstring endstr; for (int j = 0; j < str.GetLength(); j++) { wchar_t temp = wchar_t(*(valptr + j)); endstr += temp; }I basically had to loop through it using pointers and convert each character. There's probably a better way to do this though.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2020-11-05 10:24 AM
2020-11-05
10:24 AM
If it works in one of the example projects, it should work for everyone. If it doesn't, it suggests a compiler version or toolkit outside the range specified by GS is being used. If you want a real answer, it would be useful to know which compiler, version and toolset are you using.
Ralph Wessel BArch
Central Innovation
Central Innovation