• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1707
  • Last Modified:

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
0
SkAtAn
Asked:
SkAtAn
1 Solution
 
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
The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.

 
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
 
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now