> On 04/23/2011 04:23 AM, Mandeep wrote: > > I have created a stream from stdout by using the following method. > > > > new CFile(stdout.getFP(), FileMode.Out) > > > > It works but is this the correct way or is there a better way to achieve > > this without FP. > > > > Thanks & Regards > > Mandeep > > Consider streams gone from D. They are deprecated in favor of a "range" > interface. std.range and std.algorithm have examples of ranges that are > first introduced in this article (with different names in Phobos): > > http://www.informit.com/articles/printerfriendly.aspx?p=1407357
That's not quite true. You've misunderstood. Ranges are heavily used in Phobos, and most modules use them and are going to use them. std.stream is the current module for streaming I/O in Phobos. However, it is old and does _not_ use them. It probably has other issues with it that make it so that it's considered deficient anyway, but I haven't really used it much, so I'm not all that familiar with it. Regardless, because std.stream is old and does not use streams, it's going to be replaced with a new module (possibly called std.stream) which _does_ use ranges. However, that new module has not been completed or even completely designed as far as its basic API goes. So, std.stream as it stands is going away. None of the current I/O streaming in Phobos will be sticking around in the long run. However, it will be replaced with new I/O streaming functionality which is range-based at some point in the future. As the new stuff is nowhere near complete, the old stuff is still there, but eventually it won't be. - Jonathan M Davis