View mode: basic / threaded / horizontal-split · Log in · Help
October 10, 2004
standard input/output
What are the names of the standard input/output files or streams ?
October 10, 2004
Re: standard input/output
Valéry Croizier wrote:
> What are the names of the standard input/output files or streams ?

Funny, I wasn't enable to find that information either.

They are called stdin and stdout. So easy it is hard...

--anders

PS. Here is a useful sample program I wrote:

> /*
>  * Escape ISO-Latin-1 characters as
>  * Unicode \uXXXX escapes, in ASCII
>  *
>  * written by Anders F Bj\u00f6rklund :-)
>  * (C) 2004 afb. All rights reserved.
>  *
>  */
> 
> import std.stream;
> 
> void main(char[][] args)
> {
>     try
>     {
>         ubyte b;
>         while(1)
>         {
>             stdin.read(b);
>             if (b >= 0x00 && b <= 0x7f)
>                 stdout.write(b);
>             else
>                 stdout.writef("\\u00%2x", b);
>         }
>     }   
>     catch (ReadException ex)
>     {
>     }
> }

Great for editors that don't understand UTF-8...
Top | Discussion index | About this forum | D home