Issue with writefln ?

Marcin Kuszczak aarti at interia.pl
Wed Apr 4 15:22:23 PDT 2007


0ffh wrote:

> 
> Hija,
> 
> I get an exception (std.format string) thrown
> after I read a file with std.file.read and try
> to writefln its content, while it works fine
> with toStringz and printf.
> 
> Code is something like:
> 
> char[] s=cast(char[])stf.file.read("name.ext");
> printf("<%s>\n",toStringz(s)); // works fine
> writelnf("<",s,">"); // exception generated
> 
> I have shrunk the file to:
> 
> garble"%"urgh
> 
> I do strongly suppose that the problem lies
> somewhere in part saying "%" , but... ?
> 
> Is this a Hemiptera? :-)
> 
> Regards,
> 
>    frank

I think that your file has non UTF-8 characters inside (characters with
codes >= 128).

char[] is in D UTF8 sequence. 

You probably should first recode your file.

-- 
Regards
Marcin Kuszczak (Aarti_pl)
-------------------------------------
Ask me why I believe in Jesus - http://zapytaj.dlajezusa.pl (en/pl)
Doost (port of few Boost libraries) - http://www.dsource.org/projects/doost/
-------------------------------------




More information about the Digitalmars-d mailing list