We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>


Looking For Something at vustudents.ning.com? Click Here to Search

CS609 Example Code & in seek of INT

+ Click Here To Join also Our facebook study Group.

..How to Join Subject Study Groups & Get Helping Material?..


See Your Saved Posts Timeline

Views: 407

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Replies to This Discussion

Code:1

First example at page 16 of handout has no error:

And output is:

Code:2

First example 2 at page 17 of handout has 4 errors:

& correct code is given by:

===========================

#include<DOS.H>
#include<conio.h>
#include<stdio.h>
struct full
{
unsigned int ax;
unsigned int bx;
unsigned int cx;
unsigned int dx;
};
struct half
{
unsigned char al;
unsigned char ah;
unsigned char bl;
unsigned char bh;
unsigned char cl;
unsigned char ch;
unsigned char dl;
unsigned char dh;
};
union tagREGS
{
struct full x;
struct half h;
}REGS;

union REGS regs;


void main (void )
{
regs.h.al = 0x55;
regs.h.ah = 0x99;
printf ("%X",regs.x.ax);
getch();
}

its output is correct:

see

Code:1

First example 3 at page 19 of handout has 3 errors:

-------------------------------------

& correct code is:

===========

#include<stdio.h>
#include<fcntl.h>
#include<io.h>
#include<BIOS.H>
#include<DOS.H>
#include<conio.h>
unsigned int handle;
void main()
{
union REGS regs;
unsigned long int size;
handle = open("D:/TC/abc.txt",O_RDONLY);
regs.x.bx = handle;
regs.h.ah = 0x42;
regs.h.al = 0x02; //correction
regs.x.cx = 0;
regs.x.dx = 0;
int86(0x21,&regs,&regs);
*((int*)(&size)) = regs.x.ax;
*(((int*)(&size))+1) =regs.x.dx;
printf ("Size is %d" ,size);
getch();
}

If you text file is at path:

               "D:/TC/abc.txt"

then output will be correct otherwise wrong:

see

Thanks for sharing Zakki

No, dear its right.

You just need to run it in 16 bit environment (means MS DOS). In Windows , being a protected mode OS, you will not be able to get the exact output.

The better way is to make DOS Bootable USB & install turbo c on it & run all c programs.

RSS

Latest Activity

Today Top Members 

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service