D - Support for cout and cin
- ranjit_bh hotmail.com (2/2) Mar 10 2003 I have just been introduced to D. But if there is support for c++ why w...
- Sean L. Palmer (5/7) Mar 10 2003 D is more properly a descendant of C than of C++.
- Ilya Minkov (21/23) Mar 12 2003 You can write a library, but you're almost on your own. You can take
I have just been introduced to D. But if there is support for c++ why was not the cout or the cin operator not allowed for in D
Mar 10 2003
D is more properly a descendant of C than of C++. Sean <ranjit_bh hotmail.com> wrote in message news:b4jtvq$edd$1 digitaldaemon.com...I have just been introduced to D. But if there is support for c++ why wasnotthe cout or the cin operator not allowed for in D
Mar 10 2003
ranjit_bh hotmail.com wrote:I have just been introduced to D. But if there is support for c++ why was not the cout or the cin operator not allowed for in DYou can write a library, but you're almost on your own. You can take advantage of D support for standard C runtime, but not C++ which is too clumnsy and not a target for D. We want something more elegant than C++. I have here an implementation written for an ehanced C compiler supporting operator overloading, which is though incomplete, might give you an idea of how to do it if you like. It was written by the maintainer of LCC-Win32 and only works in it, should requiere a moderate amount of change and refractoring to work in D. HINT: you're not changing this libarary but writing a new one "inspired" by it and the original C++ iostream. :) For you to get started: the library expects the main application to create the cout buffer. A buffer can either be a file, of a dynamic cstring. If you want it as a file, you open the file as usual and pass it to "iostream_new_from_file(FILE *)". In the case you want it to be a string, you use "iostream_new_from_string(char * buf, int length)". If you pass NULL as buf it shall allocate memory as requiered all by itself. Length limits the length, unless it is 0. This would be simplified in D. Hope this can be helpful. -i.
Mar 12 2003