Array slicing
Hasan Aljudy
hasan.aljudy at gmail.com
Thu Dec 14 14:11:01 PST 2006
printf is not a part of D.
use writef instead.
import std.stdio;
Heinz wrote:
> Hi, i'm trying to slice an array of chars and print it to the screen but it
> doesn't seems to work, here's the code:
>
> /////////////////////////////////////
> import std.string;
>
> alias char[] string;
>
> int main(char[][] args)
> {
> printf("hello world\n");
> string hw = "Hello_World";
> printf(cast(char*)hw[0 .. 5]);
> return 0;
> }
>
> /////////////////////////////////////
>
> What could be wrong? it just prints to the output "Hello_World".
>
> Heinz
More information about the Digitalmars-d-learn
mailing list