digitalmars.D.learn - File reading and interpretation
- Ald (25/25) Sep 09 2005 Is there a good tutorial on type conversion between bytes, strings and U...
- Derek Parnell (9/13) Sep 09 2005 The 'encode()' routine takes a SINGLE utf32 character and appends it to ...
Is there a good tutorial on type conversion between bytes, strings and UTF32 strings? I have read all the manuals I found, yet the following code can only in pieces, but not as a whole: void main() { ubyte[4] buffer4; char[3] trans; //other size set==array copy lengths error line 17 dchar[] kanaChar; File table1 = new File(); table1.open("chartable1.txt", FileMode.In); table1.readExact(buffer4, 2); trans[] = toString(*buffer4); //line 17 writefln(trans); kanaChar = toUTF32(trans); writefln(kanaChar); encode(trans[], kanaChar[]); //but this function wants resizable string writefln(kanaChar); kanaChar = decode(trans, 0); writefln(kanaChar); kanaChar[0] = 0x239; writefln(kanaChar); table1.close(); } And yes, I did manage to convert arrays of ubytes to integers and longs. It was quite simple.
Sep 09 2005
On Fri, 9 Sep 2005 16:40:42 +0000 (UTC), Ald wrote:Is there a good tutorial on type conversion between bytes, strings and UTF32 strings? I have read all the manuals I found, yet the following code can only in pieces, but not as a whole:encode(trans[], kanaChar[]); //but this function wants resizable stringThe 'encode()' routine takes a SINGLE utf32 character and appends it to the supplied utf string. encode(trans, kanaChar[0]); -- Derek Parnell Melbourne, Australia 10/09/2005 8:05:28 AM
Sep 09 2005