Replies: 2 comments
-
maybe you can get away with
VAR s := ARRAY [0..4] OF CHAR { 't', 'e', 'x', 't', '\000' };
or somesuch thing. Then pass ADR(s) to your C function. (Careful about
going out of scope, though.)
…On Wed, Sep 14, 2022 at 5:08 AM zpu2tw ***@***.***> wrote:
From the document it seems you can't do sth like this:
var s: Cstring.char_star = "text";
https://modula3.github.io/cm3/help/gen_html/m3core/src/C/FreeBSD3/Cstring.i3.html
https://modula3.github.io/cm3/help/gen_html/m3core/src/C/Common/M3toC.i3.html
You have to create a variable with type TEXT, initialize it: var t: TEXT =
"text"; then use M3toC's functions to copy the value of it to s: s :=
M3toC.CopyTtoS(t);
I wanted to know if there is a way to create and initialize the C string
directly. Thanks.
—
Reply to this email directly, view it on GitHub
<#1082>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKYNJJUO6MT575CW5HFNZTV6G55TANCNFSM6AAAAAAQMLGPRY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
On 9/14/22 07:08, zpu2tw wrote:
From the document it seems you can't do sth like this:
var s: Cstring.char_star = "text";
https://modula3.github.io/cm3/help/gen_html/m3core/src/C/FreeBSD3/Cstring.i3.html
https://modula3.github.io/cm3/help/gen_html/m3core/src/C/Common/M3toC.i3.html
You have to create a variable with type TEXT, initialize it: var t: TEXT = "text"; then use M3toC's functions to copy the value of it to s: s := M3toC.CopyTtoS(t);
I wanted to know if there is a way to create and initialize the C string directly. Thanks.
VAR s: Cstring.char_star = M3toC.CopyTtoS("text")
But you when there are two different representations of
strings, you could not avoid coding something (CopyTtoS)
to denote which one.
… —
Reply to this email directly, view it on GitHub <#1082>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABSVZNBTIJXKCVMNX6INYXLV6G55TANCNFSM6AAAAAAQMLGPRY>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
From the document it seems you can't do sth like this:
var s: Cstring.char_star = "text";
https://modula3.github.io/cm3/help/gen_html/m3core/src/C/FreeBSD3/Cstring.i3.html
https://modula3.github.io/cm3/help/gen_html/m3core/src/C/Common/M3toC.i3.html
You have to create a variable with type TEXT, initialize it: var t: TEXT = "text"; then use M3toC's functions to copy the value of it to s: s := M3toC.CopyTtoS(t);
I wanted to know if there is a way to create and initialize the C string directly. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions