problems printing a dchar
torhu
fake at address.dude
Sun Feb 25 15:13:31 PST 2007
Orgoton wrote:
> this code will result on a win32 exception when trying to writefln "nomeEnt"
>
> import std.stdio;
> import std.intrinsic;
> import std.stream;
> import std.string;
>
> int main()
> {
> ushort tamanho;
> ubyte[] buffer1, buffer2;
> dchar[255] nomeEnt='\0', nomeSai;
> writef("Introduza o tamanho da matrix de encriptacao: ");
> scanf("%d", &tamanho);
> buffer1.length=tamanho*tamanho;
> buffer2.length=tamanho*tamanho;
> writef("Introduza o nome do ficheiro a encriptar: ");
> scanf("%s", &nomeEnt);
> writef("Abrindo " );
> getch();
> writefln(nomeEnt);
> //File fichEnt=new File(nomeEnt, FileMode.In);
> //buffer1.length=0;
> //buffer2.length=0;
> return 0;
> }
>
> Also, changing "dchar" to "char" will print the string, but will also cause the program to throw "invalid UTF-8 sequence. Suggestions?
scanf doesn't work with utf-32. Try looking at std.cstream instead.
More information about the Digitalmars-d
mailing list