The problem with the conversion.

drug drug2004 at bk.ru
Wed Jun 19 14:58:44 UTC 2019


19.06.2019 17:52, Den_d_y пишет:
> void load (const (char *) path)
> {
>      SDL_Surface ab = SDL_LoadBMP (path);
>      a = SDL_CreateTextureFromSurface (ab);
>      SDL_FreeSurface (ab);
> }

try the following:
```
void load (string path)
{
     import std.string : toStringz;
     SDL_Surface ab = SDL_LoadBMP (path.toStringz); // toStringz 
converts string to null terminated char*
     auto a = SDL_CreateTextureFromSurface (ab);
     SDL_FreeSurface (ab);
}
```


More information about the Digitalmars-d-learn mailing list