Manually implementation of gotoXY( int, int ) function

T

Teo81

Hi! I'm using visual studio 6.0 and I need to interact with DOS
console. I know the conio.h library but, under visual studio, it
doesn't provide useful functoins like gotoXY( int, int ) etc.... My
question is: is there a method to implement manually this kind of
functions with standard library or do I have to interact directly with
Windows's API?

Thanks
 
J

Jack Klein

Hi! I'm using visual studio 6.0 and I need to interact with DOS
console. I know the conio.h library but, under visual studio, it
doesn't provide useful functoins like gotoXY( int, int ) etc.... My
question is: is there a method to implement manually this kind of
functions with standard library or do I have to interact directly with
Windows's API?

Thanks

There is absolutely no way at all to implement any sort of video
display control directly in standard C. C does not talk to devices
like keyboards, video displays, printers, etc. All C input and output
is defined in terms of FILE * streams prototyped in <stdio.h>. It is
up to the underlying operating system to connect these streams to disk
files or devices.

Windows does provide a large number of functions for console
applications. A good place to start looking at them is:

http://msdn.microsoft.com/library/d.../dllproc/base/character_mode_applications.asp

Note that this is a platform specific issue, and not a C language one.
Future questions about this topic should be asked in a group like
or in one of Microsoft's
groups in the family.
 
K

Keith Thompson

Jack Klein said:
There is absolutely no way at all to implement any sort of video
display control directly in standard C. C does not talk to devices
like keyboards, video displays, printers, etc. All C input and output
is defined in terms of FILE * streams prototyped in <stdio.h>. It is
up to the underlying operating system to connect these streams to disk
files or devices.

Basically true, but I think it overstates it a bit. There is no
*portable* way to implement video display control in standard C, but
you can implement it non-portably (given a few assumptions) without
resorting to any non-standard features or libraries. Such code
depends on implementation-defined behavior. (For example, if you
assume a VT100-style or xterm-style terminal, you can write control
codes to stdout.)

But the best way to do this kind of thing is usually to use some
system-specific library such as curses, ncurses, or whatever Windows
provides.
 
M

Malcolm

Keith Thompson said:
Basically true, but I think it overstates it a bit. There is no
*portable* way to implement video display control in standard C, but
you can implement it non-portably (given a few assumptions) without
resorting to any non-standard features or libraries. Such code
depends on implementation-defined behavior. (For example, if you
assume a VT100-style or xterm-style terminal, you can write control
codes to stdout.)

But the best way to do this kind of thing is usually to use some
system-specific library such as curses, ncurses, or whatever Windows
provides.
In the bad old days computer manufacturers used to provide IO libraries
which were useless for any type of professional programming, because they
updated the screen too slowly. So you had to hack into the system and write
directly to screen memory, or use other tricks.

That is no longer usually true, because a modern processor is usually fast
enough to update the screen every video refresh. So you are better off using
the proper libraries.
 
P

Peter Shaggy Haywood

Groovy hepcat Teo81 was jivin' on 18 Feb 2006 07:20:36 -0800 in
comp.lang.c.
Manually implementation of gotoXY( int, int ) function's a cool scene!
Dig it!
Hi! I'm using visual studio 6.0 and I need to interact with DOS
console. I know the conio.h library but, under visual studio, it
doesn't provide useful functoins like gotoXY( int, int ) etc.... My
question is: is there a method to implement manually this kind of
functions with standard library or do I have to interact directly with
Windows's API?

This can't be done in standard C. It can only be done by
non-portable means.
I could be wrong, but I believe the Visual Studio compiler is a
Windows compiler. It cannot, therefore, interact directly with DOS.
You need a DOS compiler for that.
Once you have a DOS compiler, go to comp.os.msdos.programmer and ask
your question, as it is off topic here in comp.lang.c.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,228
Latest member
MikeMichal

Latest Threads

Top