Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changes between Version 4 and Version 5 of RandomioExample

Show
Ignore:
Author:
erpe (IP: 89.247.76.212)
Timestamp:
03/01/10 22:41:10 (14 years ago)
Comment:

0.99.9 - compat

Legend:

Unmodified
Added
Removed
Modified
  • RandomioExample

    v4 v5  
    99*******************************************************************************/ 
    1010 
    11 private import  tango.io.protocol.Reader, 
    12                 tango.io.protocol.Writer, 
    13                 tango.io.FileConduit; 
     11private import  tango.io.device.File, 
     12                tango.io.stream.Data; 
    1413 
    1514void main() 
    1716        // open a file for reading 
    1817        auto fc = new FileConduit ("random.bin", FileConduit.ReadWriteCreate); 
     18         
    1919        scope (exit) 
    2020               fc.close; 
    2121 
    2222        // construct (binary) reader & writer upon this conduit 
    23         auto read  = new Reader (fc); 
    24         auto write = new Writer (fc); 
     23        auto output = new DataOutput(fc); 
     24        auto input = new DataInput(fc); 
    2525 
    2626        int x=10, y=20; 
    2727 
    2828        // write some data and flush output since IO is buffered 
    29         write (x) (y) (); 
     29        output.int32(x); 
     30        output.int32(y); 
     31        output.flush; 
    3032 
    3133        // rewind to file start 
    3335 
    3436        // read data back again, but swap destinations 
    35         read (y) (x); 
     37        y = input.int32; 
     38        x = input.int32; 
    3639 
    3740        assert (y==10);