|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
D - converting wide to c
ok i looked thru the string functions an found toCharz() to convert a wide
string to a null terminated string, but when i tried to use it it told me it
wasnt appreciated :( (depreciated lol) so then i of course i tried to write my
own an failed miserably... would anyone care to give me a hint on how to make
this work? or is there another function i can use somewhere... thanks
//Convert a wide string to a 'c' string
char[] WideToAscii(wchar[] WideArr) {
int i = 0;
int Count = 0;
char[] CharArr;
i.init;
Count.init;
if ( WideArr.length > 0 ) {
CharArr.length = (WideArr.length / 2) + 1;
while ( i < WideArr.length ) {
CharArr[Count] = (char) WideArr[i];
i += 2;
Count += 1;
}
}
CharArr[CharArr.length - 1] = (char)r"0";
return CharArr;
}
:) yes i have a long way to go lol
Dec 18 2003
Check out std.utf.toUTF8(wchar[]). "Lewis" <dethbomb hotmail.com> wrote in message news:brtfti$20j8$1 digitaldaemon.com...ok i looked thru the string functions an found toCharz() to convert a wide string to a null terminated string, but when i tried to use it it told me Dec 18 2003
Walter wrote:Check out std.utf.toUTF8(wchar[]). Dec 18 2003
wow i can see a bad habit starting, but how is it possible to have 3 functions with the same name? how do i specify which one to use (it just wants to use the first one and i get a type mismatch compile error) Do i have to comment out the ones that i dont want to use? sorry if im being a pain Dec 18 2003
Lewis wrote:wow i can see a bad habit starting, but how is it possible to have 3 functions with the same name? Dec 18 2003
J C Calvarese wrote:Lewis wrote:wow i can see a bad habit starting, but how is it possible to have 3 functions with the same name? Dec 18 2003
It picks one based on the type of the argument you supply to it. "Lewis" <dethbomb hotmail.com> wrote in message news:brtv0l$2mvh$1 digitaldaemon.com...wow i can see a bad habit starting, but how is it possible to have 3 Dec 18 2003
|