www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.stream

reply novice2 <novice2_member pathlink.com> writes:
I have dmd 0.118 and need to parse string, contain xml.
But all xml libraries i found using stream as input data.
So i need construct stream from char[].
I found in TArrayStream!(char[]) in std.stream.
But can't compile small test program.
Any advices?

#---file t.d---

private import std.stream;

void main()
{
char[] myString = "test string";
TArrayStream!(char[]) myStream = new TArrayStream!(char[]) (myString);
}


#---linker error---
t.obj(t) 
Error 42: Symbol Undefined _array_3std6stream
--- errorlevel 1
Mar 16 2005
parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
"novice2" <novice2_member pathlink.com> wrote in message 
news:d18p7o$d7e$1 digitaldaemon.com...
I have dmd 0.118 and need to parse string, contain xml.
 But all xml libraries i found using stream as input data.
 So i need construct stream from char[].
 I found in TArrayStream!(char[]) in std.stream.
 But can't compile small test program.
 Any advices?

 #---file t.d---

 private import std.stream;

 void main()
 {
 char[] myString = "test string";
 TArrayStream!(char[]) myStream = new TArrayStream!(char[]) (myString);
 }


 #---linker error---
 t.obj(t)
 Error 42: Symbol Undefined _array_3std6stream
 --- errorlevel 1

Use MemoryStream instead. It has a constructor that takes a char[] even though I notice that isn't listed in the doc. I will send Walter a update for that. The error using TArrayStream is probably due to building in debug mode but linking against a non-debug build of phobos. So I'll probably remove TArrayStream from the doc since it is a pain to work with (you must pass -release to dmd). Either that or dmd.zip needs to include debug and non-debug builds of phobos.
Mar 16 2005
parent novice2 <novice2_member pathlink.com> writes:
Use MemoryStream instead

Thank you very much! It works.
Mar 16 2005