Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > A humble C++ Question.

A humble C++ Question.
Thread Tools
Addicted to MacNN
Join Date: Nov 1999
Location: Madison, WI
Status: Offline
Reply With Quote
Apr 23, 2002, 02:31 PM
 
ok, our silly C++ book has instructions for a conio.h library. some of the stuff is cool...

I would like basicly to be able to use


<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier> gotoxy(<font color = blue>3</font>,<font color = blue>12</font>);
</font>[/code]

or something that does the same. That code moves the cursor, or insertion point that that line/char for the next line of output.

This would help me with formatting output, and yes I know output should not be my focus at this point in the game but hey, any hints?

-Owl
     
Fresh-Faced Recruit
Join Date: Apr 2002
Status: Offline
Reply With Quote
Apr 23, 2002, 11:57 PM
 
well.

gotoxy() isn't an ANSI standard c function.. your book may be for something like DOS and borland.

look into a terminal library like ncurses.
     
OwlBoy  (op)
Addicted to MacNN
Join Date: Nov 1999
Location: Madison, WI
Status: Offline
Reply With Quote
Apr 24, 2002, 07:18 AM
 
Ok, I'll try that thanks. (and welcome to the forums) Anyone else have any hints?

-Owl
     
Fresh-Faced Recruit
Join Date: Apr 2002
Status: Offline
Reply With Quote
Apr 24, 2002, 10:14 AM
 
A little more help...

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#include &lt;curses.h&gt;
int main() {
initscr();
move(<font color = blue>3</font>,<font color = blue>4</font>); <font color = brown>// like gotoxy(<font color = blue>3</font>,<font color = blue>4</font>)</font>
addstr(<font color = red>"Hello"</font>);
refresh();
endwin();

return <font color = blue>0</font>;
}
</font>[/code]

I haven't tested this under os x (works in linux)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:53 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2