• C

gotoxy()

I wan't to use the pascal function
gotoxy() in an ansi c program . No
I am NOT using a compiler with conio.h
and I don't wan't the use the linux
port of this file. I don't want to
use code that I didn't wrote myself if
you need a reason for that :).

So.. an ansi c solution for the function
gotoxy() (in pascal). This function sets the cursor position. When you write data to the output it will be printed to that
position. (x, y coordinates).

I use gcc/linux
SkAtAnAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hongjunCommented:
You can try the following

#include <curses.h>
....

move(5, 15); /* move to coord(5,15) */

....
0
SkAtAnAuthor Commented:
When I use
#include  <curses.h>

:

[freax@freax freax]$ gcc test.c
/tmp/ccEpRJy0.o: In function `main':
/tmp/ccEpRJy0.o(.text+0xc5): undefined reference to `stdscr'
/tmp/ccEpRJy0.o(.text+0xcb): undefined reference to `wmove'
collect2: ld returned 1 exit status
[freax@freax freax]$

snif ? :.(
0
SkAtAnAuthor Commented:
[freax@freax freax]$ gcc test.c
                         /tmp/ccEpRJy0.o: In function `main':
                         /tmp/ccEpRJy0.o(.text+0xc5): undefined reference to `stdscr'
                         /tmp/ccEpRJy0.o(.text+0xcb): undefined reference to `wmove'
                         collect2: ld returned 1 exit status
                         [freax@freax freax]$
0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

jjmcdCommented:
you can always do something like:

  printf("\033[5;10H");

but curses is a lot nicer, although it's not part of the ANSI C runtime library and hence won't necessarily be found on all platforms.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ready4DisCommented:
Just use the direct call to the video interrupt via inline assembly or via an interrupt call.  If you are interested, let me know and I can give you all the register values and how to set them, as well as the interrupt you have to call.  It's really simple, but may not be how you wanted it.
0
SkAtAnAuthor Commented:
this works for my application.. thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.