473,657 Members | 2,405 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 1568
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.program mer.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
1502
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 re-inventing the wheel, if there's a library out there that does this exact thing already. SERVER: Has some protected files, not in a webroot, that I want to let the client
2
1751
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 classes or libraries that I should know about. Thanks ina dvance.
3
5185
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 or compiler? 2. In GNU gcc, { int a = {0, 1, 2, 3, 4}; bool b; float c; for (int i = 0; i < 5; i++) {
2
2055
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 (non-.Net) if I wanted to fill a list it may look something like this: -------START CODE <%
32
1848
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 after much struggling with the Timer class from the threading module -- as you can see, I abandoned it for the sleep() function from timer. Please let me know if this is a good (i.e. Pythonic) way of doing this, and if it can be improved (although...
6
1694
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
2973
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> #include<conio.h> main() { char str,st;
2
1974
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 Safari and Opera. I am doing a lot of dragdrop experimentation and in some situations need a position reporting function. The function doesn't need to report the positions of exotic elements like images in button elements; however, I would like a...
1
1270
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 postback so I can Insert, Delete, Update records
5
2522
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. This is so simple in VBA but I have searched help, internet and 2 books and have yet to find a working example for VB 2005 Does anyone have a simple sample of opening a table and adding data. I know this an Access group but some here also...
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8516
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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 we have to send another system
2
1733
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.