Thread overview | |||||
---|---|---|---|---|---|
|
February 19, 2003 Bug: toString | ||||
---|---|---|---|---|
| ||||
import c.stdio; import string; int main(char[][] args) { printf(toString(0)); return 0; } I would expect to see a zero when I run this... instead I see "0123456789" is anybody else having issues with this? |
February 19, 2003 Re: Bug: toString | ||||
---|---|---|---|---|
| ||||
Posted in reply to Keir | Keir wrote:
> import c.stdio;
> import string;
>
> int main(char[][] args)
> {
> printf(toString(0));
> return 0;
> }
>
> I would expect to see a zero when I run this...
> instead I see "0123456789"
>
> is anybody else having issues with this?
>
There seems to be something amiss --
import c.stdio;
import string;
int main(char[][] args)
{
int n = 5;
puts(toString(n));
puts(toString(0));
puts(toString(n));
printf("%s\n", "past puts");
return 0;
}
56789
0123456789
56789
Error: Access Violation
--ms
|
February 19, 2003 Re: Bug: toString | ||||
---|---|---|---|---|
| ||||
Posted in reply to Keir | Keir wrote:
> import c.stdio;
> import string;
>
> int main(char[][] args)
> {
> printf(toString(0));
> return 0;
> }
>
> I would expect to see a zero when I run this...
> instead I see "0123456789"
It's not returning a nul-terminated string. Using:
printf (toStringz (toString (0)));
Should format it correctly.
|
Copyright © 1999-2021 by the D Language Foundation