Re: Wierd error (PING ROB)
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Feb 17, 2005
- 458 views
Robert Craig wrote: > > Pete Lomax wrote: > > Some wierd thing, hSaveStdout is a constant, defined as you will see > > below. But using this constant /*/broke/*/ working code... > > > > Bizarrely, calling c_func(xGetStdHandle..) inline works, but saving > > this as a constant does not !!!!!!! > > > > I get the same results on 2.4 and 2.5(a)... > > I didn't try to run this code, but it wouldn't surprise me > if you get a different value returned by GetStdHandle > before the puts() versus after it. The reason is that > I don't create any console window until you do your first output > to the screen. Maybe you could move the puts() before the constant > declaration. The puts() will then be executed before the c_func() > that's assigned to the constant. I can confirm (for Win2k, at least) that using the constant after you've already created a console works fine. Interestingly, it even seems to work after a call to free_console(). Matt Lewis