Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #653 (closed enhancement: fixed)

Opened 7 years ago

Last modified 7 years ago

tango.sys.win32 lacks functions for handling null-terminated string

Reported by: yidabu Assigned to: kris
Priority: major Milestone: 0.99.2 RC5
Component: Core Functionality Version: 0.99.1 RC4 Keep
Keywords: Windows api Cc:

Description (Last modified by yidabu)

for conveniently calling Windows Api, tango.sys.win32 should have these functions for calling A versiong api:

char* toMbsz(char[] s, uint page = 0)
char* toMbsz(wchar[] ws, uint page = 0)
char* toMbsz(dchar[] s, uint page = 0)

and these functions for calling W version api:

wchar* toUtf16z(char[] s)
wchar* toUtf16z(dchar[] s)

here is a patch.

I seen somebody use tango.stdc.stringz.toUtf8z for calling windows api, that's not right way.

Attachments

stringz.d (4.4 kB) - added by yidabu on 10/02/07 08:09:32.

Change History

10/02/07 08:09:32 changed by yidabu

  • attachment stringz.d added.

10/02/07 08:15:40 changed by yidabu

  • description changed.

10/02/07 08:21:47 changed by larsivi

  • milestone changed from 0.99.2 RC5 to 0.99.3 RC6.

10/02/07 12:59:19 changed by kris

Tango is a cross-platform library, and cannot therefore embed Win32 specifics inside a generic C oriented module :)

Perhaps tango.sys.win32.CodePage? might be of use?

10/02/07 17:14:18 changed by yidabu

That's a good idea.

10/02/07 19:38:04 changed by yidabu

  • description changed.
  • summary changed from tango.stdc.stringz lacks some useful functions to tango.sys.win32 lacks some useful functions for handling null-treminated string.

10/02/07 19:44:45 changed by kris

yes, good point

10/02/07 19:45:36 changed by yidabu

  • summary changed from tango.sys.win32 lacks some useful functions for handling null-treminated string to tango.sys.win32 lacks functions for handling null-terminated string.

10/02/07 20:30:31 changed by yidabu

how about that module named tango.sys.win32.stringz module ?

10/02/07 20:36:06 changed by kris

  • status changed from new to assigned.

I'll look into :)

10/03/07 00:46:37 changed by kris

  • status changed from assigned to closed.
  • resolution set to fixed.
  • milestone changed from 0.99.3 RC6 to 0.99.2 RC5.

CodePage? now adds a trailing null, so you can use .ptr of the return to pass to a C API. The original tango.stdc.stringz() can be used in combination as appropriate