Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 1 and Version 2 of StdInStdOutStreamsExample

Show
Ignore:
Author:
csauls (IP: 69.166.134.113)
Timestamp:
08/04/06 09:38:49 (15 years ago)
Comment:

Updated to use std.cstream's din/dout instead of std.stream.std* objects that no longer exist. Also added the new import syntax.

Legend:

Unmodified
Added
Removed
Modified
  • StdInStdOutStreamsExample

    v1 v2  
    1 = I/O on stdin and stdout streams
     1= I/O on stdin and stdout
    22 
    33''Part of'' StandardLibraryCategory 
    1313{{{ 
    1414#!d 
    15 import std.stream
    16 import std.string
     15import std.cstream : din, dout
     16import std.string  : toupper   
    1717 
    18 int main() 
    19 
    20     char[] input; 
    21     char[] output; 
     18int main () { 
     19  char[] input  , 
     20         output ; 
    2221 
    23     // Ask for a string 
    24     std.stream.stdout.writeLine("Converts a lowercase string to uppercase."); 
    25     std.stream.stdout.writeLine("Please enter a string:"); 
    26     input = std.stream.stdin.readLine(); 
     22  // Ask for a string 
     23  dout.writeLine("Converts a lowercase string to uppercase."); 
     24  dout.writeLine("Please enter a string:"); 
     25  input = din.readLine(); 
    2726 
    28     // Convert to upper and print it 
    29     output = input.toupper(); 
    30     std.stream.stdout.writeLine(output); 
     27  // Convert to upper and print it 
     28  output = input.toupper(); 
     29  dout.writeLine(output); 
    3130 
    32     return 0; 
     31  return 0; 
    3332} 
    3433}}} 
    3534 
    36 == Source == 
    37  
    38 || Link || http://www.dsource.org/tutorials/index.php?show_example=87 || 
    39 || Posted by || egon || 
    40 || Date/Time || Sun May 16, 2004 9:20 am || 
     35== Version == 
     36This example is "up-to-date" as of DMD 0.163 and may present problems with earlier or later versions.