May 07, 2002 Re: I don't know much... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos | "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 Re: I don't know much... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | >
> 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 Re: I don't know much... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos | "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. |
Copyright © 1999-2021 by the D Language Foundation