Convert Ruby string to C ++ char pointer

0

I need to call a command from a DLL by Win32Api.

LoadTexture = Win32API.new('System/SFML.dll', 'sfml_load_texture', 'p', 'p')

I made two attempts:

LoadTexture.call("folder/file.png")

This second attempt only worked on wchar_t :

buf = ''

for i in 0..filename.size - 1
  buf += filename[i] + 0.chr   end

buf += 0.chr * 260

LoadTexture.call(buf)

DLL Function:

ThemessageIgetisalwayssomethinglikethis:

  

Failedtoloadimage"=" '¶È; ð¿w c H ". Reason: Unable to open

    
asked by anonymous 19.05.2018 / 22:10

0 answers