473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

union REGS donīt get DOS Version

Hello,

I donīt know if union REGS <dos.h> is part of this group, but i have
a problem. At the moment i use turboc++lite and i donīt have reply
when i execute the question code. Only a black screen! Anyone help me?
Whatīs is wrong? This code return the DOS version.

#include <stdio.h>
#include <dos.h>
#include <conio.h> //use getch() e clrscr()

void main(void)
{
union REGS in_regs, out_regs;
in_regs.x.ax = 0x3000;

intdos(&in_regs,&out_regs);
printf("Version %d.%d\n", out_regs.x.ax & 0xFF, out_regs.x.ax
8);

}

Thx
B. Barros

Feb 7 '06 #1
4 7239
"Bruno Barros" <br**********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hello,

I donīt know if union REGS <dos.h> is part of this group,
It's not part of standard C, so not topical here.
but i have
a problem. At the moment i use turboc++lite
Try a newsgroup where that compiler is topical.
and i donīt have reply
when i execute the question code. Only a black screen! Anyone help me?
Not here.
Whatīs is wrong? This code return the DOS version.

#include <stdio.h>


This is the only part of your code which is standard.

Try a group about Turbo C, or perhaps MSDOS.

-Mike
Feb 7 '06 #2
Bruno Barros wrote
(in article
<11**********************@f14g2000cwb.googlegroups .com>):
Hello,

I donīt know if union REGS <dos.h> is part of this group,


It's not. What's DOS?

Seriously, we stick to ANSI standard C here, and that is
anything but standard. You probably want to look at a newsgroup
with DOS in the group name. For example,
comp.os.msdos.programmer

FWIW, nobody has cared much about the version of DOS in a decade
or more.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Feb 7 '06 #3
Bruno Barros a écrit :
I donīt know if union REGS <dos.h> is part of this group,
It's not. It's a Borland C extension for MS-DOS defined in <dos.h>. Not
portable at all. Very specific...

<way off-topic>
but i have
a problem. At the moment i use turboc++lite and i donīt have reply
when i execute the question code. Only a black screen! Anyone help me?
Whatīs is wrong? This code return the DOS version.
Do you have a DOS system ? Windows/XP is NOT a DOS system.
#include <stdio.h>
#include <dos.h>
#include <conio.h> //use getch() e clrscr()
Unneeded...
void main(void)
int main(void)
{
union REGS in_regs, out_regs;
in_regs.x.ax = 0x3000;

intdos(&in_regs,&out_regs);


This only works in real mode (Pure MS-DOS) or on the Windows VM (Virtual
Machine) found on DOS/Windows (3.x, 9x etc.).

On a modern OS like NT or XP, such a call will invoke an undefined
behaviour.

What exactly is your system ?

</>

--
A+

Emmanuel Delahaye
Feb 7 '06 #4
Emmanuel Delahaye wrote:
[...]
but i have
a problem. At the moment i use turboc++lite and i donīt have reply
when i execute the question code. Only a black screen! Anyone help me?
Whatīs is wrong? This code return the DOS version.
Do you have a DOS system ? Windows/XP is NOT a DOS system.


Note that XP will run 16-bit DOS executables, and emulate a 5.0 MS-DOS
system.

[...] This only works in real mode (Pure MS-DOS) or on the Windows VM (Virtual
Machine) found on DOS/Windows (3.x, 9x etc.).

On a modern OS like NT or XP, such a call will invoke an undefined
behaviour.


Actually, XP includes a DOS emulator, and the above is well-defined
when run on XP. (And NT, 2000, and 2003 as well.)

[...]

Of course, none of this makes it topical for c.l.c, so I'm wondering
why I'm posting this.

Well, it could serve as an example of why you should post in the
correct newsgroup, so you'll be more likely to get information from
people who are familiar with the platform.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>

Feb 7 '06 #5

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

Similar topics

4
by: NickName | last post by:
Hello, Bear with me (not had much sleep last night), pls see following ddl, dml and comments for what is desired, I don't have a problem getting desired result(s), however, I'm wondering if...
5
by: Lyn | last post by:
This one is difficult to explain, so I will cut it down to the basics. I have a major table 'tblA' which has an autonum field 'ID-A' as primary key (of no significance to users). 'tblA' contains...
10
by: rohit | last post by:
Hi, Iam confused as to when is the memory freed in this program. #include <stdlib.h> #include <stdio.h> #include <string.h> union test{ char *i;
3
by: Default User | last post by:
After a discussion on c.l.c++ with Ron Natalie, I'm now unclear as to the status of reading data stored as one union member, then accessed with a different one, in C99. I don't have the latest...
6
by: das | last post by:
Hello all, I have a table with thousands of rows and is in this format: id col1 col2 col3 col4 --- ------ ----- ------ ------ 1 nm 78 xyz pir 2 ...
5
by: kushmanr | last post by:
hi i am having to problems: interrupt decleration doesn`t compile: void _interrupt _far terminal_isr() ....... _dos_setvect(0xC,terminal_isr) : error C4226: nonstandard extension used :...
0
by: balajiv86 | last post by:
hi can anyone tell me the book which contains details abt inbuilt union regs in c
32
by: =?gb2312?B?zfWzrLey?= | last post by:
Union un { int I; char c; } main() { union un x; x.c=10; x.c=1;
7
by: Peter Olcott | last post by:
Why can a union have a member with a copy constructor?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.