I want my Juce application to be able to start in console mode or GUI mode. For this I want to start a simple REPL if the user passes a command line flag like “-console”. This is because the application supports Lua scripting and I want the user to have access to only the Lua console when in pure console mode(the main window is not created)
I am able to pass the command line flag but unable to implement the REPL with std::cin and std::cout as they dont work. How do I do this?
Are you on Windows? Because on Unix systems this should work out of the box, however on Windows there is no console when starting a GUI application (even if you are not creating any window). You can however create a console at runtime. I’m not working on Windows that often and it’s been a while since I did it, however I think it was done somehow like that:
This lets me take I/O from the command line.
Now, I am trying the AttachConsole() part to see if I make the console appear in the same console cmd window when I start my application from the command line. Right now it opens a new console window.