-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# ArgumentError: embedded NULs are not allowed in C strings: #5
Comments
Here is how I worked around the problem. I have three working solutions, but I am not sure which (if any) are "permissible". I would go with option 3 because it is the shortest: # Solution 1
str = "dummy"*"\0"^(27)
buf = Cstring(Base.unsafe_convert(Ptr{Cchar}, str))
CImGui.InputText("Label 1",buf, length(str))
@show str
# Solution 2
str2 = "dummy"*"\0"^(27)
buf2 = Cstring(pointer(Base.cconvert(Ptr{Cchar}, str2)))
CImGui.InputText("Label 2",buf2, length(str2))
@show str2
# Solution 3
str3 = "dummy"*"\0"^(27)
buf3 = Cstring(pointer(str3))
CImGui.InputText("Label 3",buf3, length(str3))
@show str3 |
Sorry, that's an upgrading flaw due to this commit. |
Thanks for the feedback! I'm going to tag a new version. |
Weird. I get the opposite. The examples get an error and I don't know how to fix it. I am on a linux box with julia 1.1.0. I will try one of zygmuntszpak solutions. Update: I upgraded to 1.69.1 and the issue is fixed. ;-) |
Hi,
I'm having trouble figuring out how to use
CImGui.InputText()
. The examples in the demo work correctly, but whenever I try to incorporate something similar I encounter anembedded NULs are not allowed in C strings:
error. For example, the following does not workI've made a standalone script which attempts to imitate an example in the demos:
This error is as follows:
I suspect that I am using the API incorrectly. I haven't yet worked with a scenario where I was passing data structures to a C-library so I'd appreciate any suggestions you may have.
The text was updated successfully, but these errors were encountered: