Problem with writeln
Ivan
ivan.senji at gmail.com
Mon Mar 1 07:42:00 PST 2010
On 1.3.2010 14:43, Steven Schveighoffer wrote:
> On Mon, 01 Mar 2010 07:14:23 -0500, Ivan <ivan.senji at gmail.com> wrote:
>
>> On 1.3.2010 12:47, Steven Schveighoffer wrote:
>>> On Mon, 01 Mar 2010 04:11:28 -0500, Ivan <ivan.senji at gmail.com> wrote:
>>>
>>>> The part of code in my main method is this:
>>>>
>>>> try {
>>>> writefln("Starting main loop...");
>>>> global.loop.start();
>>>> writefln("Main loop finished...");
>>>> } catch(Exception e) {
>>>> writefln("Exception was: %s", e.msg);
>>>> }
>>>>
>>>> From what I can see an exception was thrown ("unable to write to
>>>> stream") and the only line I added to the loop is this:
>>>>
>>>> writefln(". %s", counter++);
>>>>
>>>> If that line is removed, an exception seams to be thrown from the line
>>>> writefln("Main loop finished...");
>>>
>>> Post more code. I suspect you are messing up something. It appears that
>>> you may be closing stdout, but I can't be sure because your code is not
>>> complete.
>>>
>>
>> The code can be seen here: http://github.com/ivans/ifs3D
>> I didn't and still don't want to bother anyone too much. :)
>>
>> It should compile on windows with a command found in a readme file.
>>
>> I don't think I am closing stdout anywhere and I probably am doing
>> something wrong somewhere, but can't figure out where and what.
>
> Your code is too complex for me to understand quickly :)
>
> Comment out other lines until you figure out which one closes it.
>
> Start with commenting out the entire loop :) If that then works, you
> know something inside the loop is killing stdout.
>
> BTW, are you compiling in Windows mode? I.e. do you see a console on the
> screen when you run it? If not, then there is no stdout or stdin. From
> your command line in the readme, I don't think you are. However, in that
> case, I don't think you'd get anywhere or see any output.
Thank you for helping. I did what you suggested and started commenting
out code to get it working. I finally got to a working code with just
two lines commented out:
http://github.com/ivans/ifs3D/commit/339ca5ee58661d636bfcd878c08b06bacede7dca
These lines have nothing to do with streams and stdout, so I still don't
understand what is going on. But this part of code is very old and
stupid (allocating a lot of unneccessary real[][]'s) so I guess the next
step is to figure out a smarter way to do that part and see if the
exception goes away :).
Uh I have missed debuging D programs :).
More information about the Digitalmars-d
mailing list