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(ch)) // print as a character p++ } free (s) // done with the memory now