D - Help anyone?
- Andrew Edwards (21/21) Sep 12 2002 charset="iso-8859-1"
- Pavel Minayev (7/26) Sep 12 2002 Yes, it is supposed to work that way. Unlike C++ iostreams,
-
Andrew Edwards
(5/5)
Sep 13 2002
"Pavel Minayev"
wrote in message
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
the following code:
import stream;
import file;
int main (char[][] args)
{
File file = new File;
file.create("test.txt");
int a = 0, b = 1;
for (int i = 0; i < 1000; i++)
{
int c = a + b;
file.write(c);
a = b; b = c;
}
return 0;
}
generates the attached file. Does this happen to anyone except me?
Thanks in advance,
Andrew
Sep 12 2002
Andrew Edwards wrote:
the following code:
import stream;
import file;
int main (char[][] args)
{
File file = new File;
file.create("test.txt");
int a = 0, b = 1;
for (int i = 0; i < 1000; i++)
{
int c = a + b;
file.write(c);
a = b; b = c;
}
return 0;
}
generates the attached file. Does this happen to anyone except me?
Yes, it is supposed to work that way. Unlike C++ iostreams,
Stream.write() saves data as binary, not as text.
If you nead to read/write text files, use Stream.printf() and
Stream.scanf().
By the way, there is no need to import file.d in your program. stream.d
would be enough.
Sep 12 2002
"Pavel Minayev" <evilone omen.ru> wrote in message news:alrsvt$gvj$1 digitaldaemon.com... | By the way, there is no need to import file.d in your program. stream.d | would be enough. That was my next question! Thank you very much!
Sep 13 2002








"Andrew Edwards" <crxace13 comcast.net>