STDOUT does not working?

Previous topic - Next topic

spacefractal

Im a doing a little pixel palette application to convert images to Spectrum Next, so im need the graphics video. but when that is used, then STDOUT does NOT work at all. Its does nothing at all, and im have no idea how to declare __AllocConsole() to been send to the commandpromth when running from there or from a bat file.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

bigsofty

I'm still on 14.x and it works fine for me on Windows & Android. Have you tried it via inline? It may be redirected to a debug log?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

dreamerman

Never tried STDOUT in console app but it should work, despite that some time ago I noticed that GLB closes out buffer (or whatever it's called) only after app ends. So to catch STDOUT in my editor I use this work-around:
Code (glbasic) Select

INLINE
        }
                extern "C" {
                        #include <cstdio>
                }
        namespace __GLBASIC__ {
ENDINLINE

FUNCTION stdout_fix:
        INLINE
                setbuf(stdout, NULL);
        ENDINLINE
ENDFUNCTION

Don't put this into main source file, call 'stdout_fix()' after load/init, and should work, also for bat files, so you can do 'path/app.exe >> out.txt' in cmd.
Check my source code editor for GLBasic - link Update: 20.04.2020