RosettaCodeData/Task/Call-a-foreign-language-function/Aikido/call-a-foreign-language-function-3.aikido
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

14 lines
386 B
Text

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