Skip to main content
gamedev.net
🔒 Locked

Console commands

Started by NiBLiTz Mar 1, 2000 at 2:14 AM 7 replies 650+ views
Original Post
NiBLiTz
NiBLiTz
I was wondering, for a win32/MAC console commands (as in black box''d white text C:>) What are the commands for placing hte cursor and writing text in that position for C++ (or c if it is poosible to make a call to a c fuinction from the the source.) If you don''t understand what i mean i am talking about things like cout and cin, but they can be put anywhere on the screen. (according to where i say with X & y) NiBLiTz - ALL that is needed
NiBLiTz - ALL that is needed
SiCrane
SiCrane
There aren''t stanard C/C++ commands for doing such a thing. You either need to call low level function directly, (such as setting video text memory), or get a library that implements that functionality, such as curses or ncurses.
Veldrik
Veldrik
Exactly like you would do it in a normal DOS program (in the case of the Win32 console or a Macintosh Softwindows console, or OS/2).


#include <conio.h>
int main(void)
{
clrscr();
gotoxy(15,18); // this function positions the cursor.
cprintf("Hello world");
getch();
while(kbhit())
getch();
return 1;
}


Blast, darned braces dissapeared.

Edited by - Veldrik on 3/1/00 5:51:25 AM
NiBLiTz
NiBLiTz
Yeah i meant the dos console commands. BUT preferably for C++. Or should i just use the C version of the commands. Cause they look easier to use. i currently know only of cin.get() gets a single character. BUT now i know of the gotoxy(x,y) one.. is it the same in C++?? What are the output/input commands so i can go anywhere and refresh a certain place (akthough i beleivei just put the text over the lasdt one and that does it for me.)

NiBLiTz - ALL that is needed
NiBLiTz - ALL that is needed
osmanb
osmanb
Basically, none of this has ANYTHING to do with C vs. C++. It''s all part of platform-specific libraries that your compiler vendor (or someone) provides. Most of those libraries (conio, for example) have simple C-like interfaces, though there might be a C++ version in some newer compilers. On the other hand, the vendors probably don''t consider that a priority anymore (except maybe in UNIX-land, with updated versions of curses) since MS expects most people to write gooey apps. In the end, you''ve got to read the docs for whatever compiler you''re using.

-Brian
NiBLiTz
NiBLiTz
ok. So i am using VC++ 6.0 standard. So i pretty much have most of the library''s that are for c && c++. So i should just use the old C versions of sunctions (1 they look better and are easier to undersdtand. 2. they are plentiful and more commonly found on the net.) All i need is a list or something on most of these. i''ve looked in the MSDN on my CD and not found much at all.

NiBLiTz - ALL that is needed
NiBLiTz - ALL that is needed
NiBLiTz
NiBLiTz
Actually.. all i need is an easy to understand list of the commands and what they. Also something on the file input&output would be nice. Maybe a link or something.

NiBLiTz - ALL that is needed
NiBLiTz - ALL that is needed
Qoy
Qoy
If you''re using VC++, then you should have the MSDN. Just go to the help contents, and go to the VC++ start page, VC++ Programmers Guide, and there should be a not too hard to find list of all the functions in the C Runtime Library and the C++ Standard Library, grouped by category. It pays to look around the docs a bit, especially when they are as extensive as the VC++ docs...

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.