Thread overview
Bug: toString
Feb 19, 2003
Keir
Feb 19, 2003
Michael Slater
Feb 19, 2003
Burton Radons
February 19, 2003
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
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
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.