May 07, 2002
"Carlos" <carlos8294@msn.com> wrote in message news:ab7in0$k5l$1@digitaldaemon.com...

> Like this?

Like this:

import c.stdio;
import string;

int main()
{
    char[] w;
    char[100] w1;

    printf("Write your name: ");
    scanf("%s", w1);
    w = w1[0 .. strlen(w1)];
    printf("Hi, %.*s\n", w);
}



May 07, 2002
>
> Like this:
>
> import c.stdio;
> import string;
>
> int main()
> {
>     char[] w;
>     char[100] w1;
>
>     printf("Write your name: ");
>     scanf("%s", w1);
>     w = w1[0 .. strlen(w1)];
>     printf("Hi, %.*s\n", w);
> }
>
>
So, basically, every single time you want to read a string, you must create two spaces in memory. Isn't this redudant, absurd or something like that?


May 07, 2002
"Carlos" <carlos8294@msn.com> wrote in message news:ab7j5i$kj8$1@digitaldaemon.com...

> So, basically, every single time you want to read a string, you must
create
> two spaces in memory. Isn't this redudant, absurd or something like that?

It is. It's because the D run-time library, Phobos, is far from completion,
so you have to use C functions. Of course, later versions will introduce
a better way to read user input.


1 2
Next ›   Last »