Problem with writeln

Steven Schveighoffer schveiguy at yahoo.com
Mon Mar 1 05:43:40 PST 2010


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.

-Steve



More information about the Digitalmars-d mailing list