473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

C++/SDL: Working console

83
Does anyone here know how to make the a working console when using SDL.
I only managed to get it working when running from cmd, when I execute the app, it displays a console box, but text does not display.

I found this code that creates the console box and stops SDL writing stdout:
Expand|Select|Wrap|Line Numbers
  1. freopen("CON", "w", stdout);
  2. freopen("CON", "w", stderr);
But does anyone know how make the console box display text when run from a .exe?
Aug 9 '08 #1
4 6461
Adam01
83
Does anyone use SDL here? (Bump)
Aug 16 '08 #2
TamusJRoyce
110 100+
A lot of use do. But we use it so much, we don't visit this forum nearly enough. That's how good it is :P

It's a compiler/platform specific problem in having the console come up.

You can do it the hard way and include "windows.h," and use windows speicific api to open up the console.

As for mingw, include as a compiler directive -mconsole for a console. For a window it's -mwindow. both it's -mconsole -mwindow. Search about this to be sure.

For visual c++, I'm sure it's in the ide or there may be a compiler directive. You'd have to search.

But this specific question is kinda tough to answer since it isn't sdl related, which is why no one has probably answered about this so long.
Aug 19 '08 #3
Adam01
83
That creates a console window, but no output is displayed on it.
Aug 24 '08 #4
oler1s
671 Expert 512MB
http://forums.codeblocks.org/index.p...prev_next=next Google a bit more. (Or to be precise, just throwing random code snippets won't help, the code there works on the C STDOUT and STDIN fds). You are probably using std::cout, so you can't write the same code.

You'll come across ideas like: http://www.williamwilling.com/blog/?p=74
Aug 24 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Joey \Ninwa\ Bleau | last post by:
I'm not quite sure if this is the right place to place my problem but it's one of the largest C++ groups I can find so I figure it has a rather diverse crowd. That, and there's no SDL group I'm...
1
by: MPD | last post by:
Hi, I'm new to the MPW (Mac Programmers Workshop -- Apple's now freely avilable development tools for Classic Mac OS's) and wish to construct a simple 2D game using MPW's C++ compiler and SDL. ...
1
by: Camilla | last post by:
I'm making one of my first web services (with C#) and need help getting started. I have received an idl file and a sdl file that describes the interface I need to implement... but how do I...
3
by: Alvo von Cossel I | last post by:
hi, i have a working console app. however, it closes as soon as it opens. i know that it works because i can just about read it. how do i stop it from closing straight after opening? -- Alvo...
7
by: Ivan | last post by:
Hi all, i', tryng to make this code work ..... it compiles but , when i exec, i've got Segmentation Fault Where i was wrong??? (i'm using Gcc) my C code:
2
by: Greg Ewing | last post by:
Whenever I try to use the FreeSans font with SDL, either through PyGame or Soya, I get disappointing results. The characters come out slightly higglety-pigglety -- randomly displaced up or down a...
7
by: smartbeginner | last post by:
I cannot view in the console what all i have included in printf() .Why this? Code: #include<stdio.h> #include<conio.h> #include "SDL/SDL.h" int main(void) { int x=1; SDL_Event event;
2
by: JonLT | last post by:
Hi! My program (a raytracer) needs a lot of calculations so i thought it would be a good idear to use threads. I'm allready using the SDL lib in the program so the SDL threads seemed a good...
0
by: L. Lindstrom | last post by:
I build the Pygame releases for Windows. Pygame wraps the Simple Directmedia Layer (SDL) C library. I am doing preliminary research into porting Pygame to Python 2.6. For Pythons 2.4 and 2.5 the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.