www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - standard input/output

reply "Valéry Croizier" <valery freesurf.fr> writes:
What are the names of the standard input/output files or streams ?
Oct 10 2004
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
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...
Oct 10 2004