Record separator is being lost after string cast

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 4 00:59:02 PST 2015


On Wed, 04 Feb 2015 08:13:28 +0000, Kadir Erdem Demir wrote:

> A more general and understandable code for first question :
> 
>      ubyte[] temp = [ 65, 30, 66, 30, 67]; writeln(temp);
>      string tempStr = cast(string) temp;
>      writeln (tempStr);
> 
> Result is : ABC which is not desired.

nothing is lost in the program. what you see is a quirk in tty output: 
'\x1f' is unprintable character, so you simply cannot see it. redirect 
the output to file and open that file in any hex editor -- and you will 
find your separators intact.

don't beleive what you see! ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150204/1a3e2067/attachment.sig>


More information about the Digitalmars-d-learn mailing list