473,503 Members | 12,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a little advice

ash
hi friends,

i was trying to make a function, which returns the scan code of a key
like up arrow,down arrow, right arrow and left arrow. here it is-

#include<dos.h>

int getkey()
{
union REGS i,o;

while(!kbhit())
;
i.h.ah=0;
int86(22,&i,&o);
return(o.h.ah);
}
and there was also rest of program but i didn`t mention here.

but when i try to compile it in BORLAND C++ 5.02 AND MICROSOFT VISUAL
C++ 6.0 ,it gives a lot of error i.e. union REGS not defined, i and o
undefined, int86 should have prototype and so on.
then i tried to compile same program in TURBO C 3.0 and it succeeded
and my program is working fine. I want to know why this piece of code
was giving error in borland 5.02 and VC++?
is there anyway to correct it.
thankx
ash

Jan 15 '06 #1
2 1554
ash said:
but when i try to compile it in BORLAND C++ 5.02 AND MICROSOFT VISUAL
C++ 6.0 ,it gives a lot of error i.e. union REGS not defined, i and o
undefined, int86 should have prototype and so on.
then i tried to compile same program in TURBO C 3.0 and it succeeded
and my program is working fine. I want to know why this piece of code
was giving error in borland 5.02 and VC++?
Because what you wrote is not actually standard C. I mean, the syntax is
standard enough, but the stuff you were using (int86() calls, REGS unions,
and all that) was a pile of extensions that were common to MS-DOS compilers
back in the 1980s and early 1990s (hence "dos.h"), but which fell out of
favour when Microsoft (R) Windows (TM) 95 (aka 4) was introduced.
is there anyway to correct it.


If you need *that* code to work, use a very old MS-DOS compiler (I keep
several around, just in case!). If you just need that functionality, yes,
there are more "modern" ways to do it, but none of those ways can be
followed in standard C - every implementation does it in its own way, it
seems - which is a nuisance. Since, presumably, you are on a Windows
platform, comp.os.ms-windows.programmer.win32 would be your next port of
call.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jan 15 '06 #2
On 14 Jan 2006 22:22:07 -0800, in comp.lang.c , "ash"
<as************@rediffmail.com> wrote:
hi friends,

i was trying to make a function, which returns the scan code of a key
See the FAQ, section 19
but when i try to compile it in BORLAND C++ 5.02 AND MICROSOFT VISUAL
C++ 6.0 ,it gives a lot of error i.e. union REGS not defined, i and o
undefined, int86 should have prototype and so on.


Different compilers have different abilities. Different OSes have
different abilities. For further details, ask again in a Windows
programming group as how you would do it under Unix, VMS, etc would be
totally different, and all would be offtopic in CLC.

Mark McIntyre
--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jan 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1498
by: Python Baby | last post by:
I'm about to try a little test project in Python, but want to make sure I'm on the right foot. Any advice appreciated before I start this. MOST important : I want to make sure I'm not just...
2
1742
by: Adam Schroeder | last post by:
I'm a computer science student looking for a little advice on network programming using TCP/IP? I'm using Borland's 5.02 compiler, but I could use Dev C++ if you advise that... is there any...
3
5178
by: gary | last post by:
Hi, 1. About all C/C++ compilers, Does stack increase from high address to low address and heap grow increase from low to high? What on earth decides their increase direction, CPU architecture, OS...
2
2041
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
32
1823
by: John Salerno | last post by:
My first project when I started learning C# was to make a little timer to tell me when my laundry was done :) and I thought it would be fun to convert this to Python. Here's what I came up with...
6
1672
by: manochavishal | last post by:
Hi , Ihave this code to show binary of an integer. #include<stdio.h> #include<stdlib.h> typedef struct binary* binaryptr; typedef struct binary { int data;
54
2924
by: ash | last post by:
i am writing this program (for exercise1-9 in k&r-2nd edition) which removes extra spaces in string example- "test string" will be "test string" #include<stdio.h> #include<string.h>...
2
1959
by: petermichaux | last post by:
Hi, It seems like determining element position in a web page is a difficult task. In the position reporting source code I've looked at there are special fixes for at least some versions of...
1
1265
by: shapper | last post by:
Hello, I need to create a data object to hold a number of records with 3 columns. A datatable would do. My problem is this: 1. I will use this as a GridView datasource. 2. I will need to...
5
2511
by: Karl | last post by:
I normally only use A2000 but I need to do a little project in VB2005 But I can't figure out how to open the backend Access table in code and add data using code. I don't need to bind to a form....
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.