Zorran wrote:
This code crash D1 compiler (v1.039)

============
import std.stdio;

void main()
{
        string ss="sample";
        printf("%s", cast(char*)(ss+"\0") );
}
===========

do u mean it actually crashes dmd at compile time or do u mean your application carshes at runtime?

try:

void foo(char[] ss)
{
    printf("my string is: %.*s\n", ss);
}

documented under: http://www.digitalmars.com/d/2.0/interfaceToC.html ("Calling printf()")

Reply via email to