RosettaCodeData/Task/Call-a-foreign-language-fun.../Aikido/call-a-foreign-language-fun...

15 lines
386 B
Plaintext

native function strdup (s) // declare native
native function free(p) // also need to free the result
var s = strdup ("hello world\n")
var p = s // this is an integer type
for (;;) {
var ch = peek (p, 1) // read a single character
if (ch == 0) {
break
}
print (cast<char>(ch)) // print as a character
p++
}
free (s) // done with the memory now