Eric,
the gmail on w2000 at the library is acting buggy, don't know if .txt
attachment made it out.
The answer to your query is in the attachment. kurt<wb2...@gmail.com>.
re: "..what uninitialized pointers, etc..."'
Eric,
you might have misconstrued what I was refering to; I had come across the
following:
void mouse_status( int *x, int *y, int *b )
{
union REGS inreg, outreg;
inreg.x.ax=0x3;
inreg.x.bx=inreg.x.cx=inreg.x.dx=0;
int86(0x33,&inreg,&outreg);
*b=outreg.x.bx;
*x=outreg.x.cx;
*y=outreg.x.dx;
}
/*
Input:
AX=0x3
Output:
BX=number of the button pressed. 1-left 2-right 3-middle
CX=x co-ordinate
DX=y co-ordinate
*/
I modified it slightly as:
void mouse_status( int *x, int *y, int *b )
{
union REGS inreg, outreg;
t:1;
inreg.x.ax=0x3;
inreg.x.bx=inreg.x.cx=inreg.x.dx=0;
int86(0x33,&inreg,&outreg);
B= *b=outreg.x.bx;
X= *x=outreg.x.cx;
Y= *y=outreg.x.dx;
}
You should note that all variables are declared globally by declaring them
above 'int main()';
also note that the 'int *b' in the declaration of mouse_status and the int *b
in the global
declarations do not have the same scope; mouse_status can only 'see' the int *b
from it's local
declaration list and cannot see the global int *b above main. This was a
coincidence.
The point is that I decided to pass the results back to 'int main()' using
global variables
instead of passing-by-reference; this made the arg-list in mouse_status
irrelevant to int main(),
as far as passing anything, but still present and requiring three pointers to
call it. I know,
it's messy and the void function could have been reworked with no arg-list, but
I admitted to
being in a hurry.
//++++++++++++++++++++++
#include<iostream>
using namespace std;
#include<dos.h>
#include<conio.h>
#include<stdlib.h>
//$$$$$$$$$$$$
int dva=10;
int dvb=20;
int dvc=30;
int *a=&dva;
int *b=&dvb;
int *c=&dvc;
//$$$$$$$$$$$$
int X=78;double x=0.0;
int Y=78;double y=0.0;
int B=0;int M=0;int N=0;
int k=0;
int r=0;
//+++++++++++++++++++++++
//********************************************
int initmouse();
void showmouse();
void hidemouse();
void mouse_status(int *x,int *y,int *b);
void obj();
void changecursor(int *shape,int x,int y);
void dmy();
void shobx();
//********************************************
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
int main()
{
At any rate, the code between the rem-$ above was not included in the first
rush-job and the
pointers were simply declared but uninitialized. They say a "wild pointer"
might do just about
anything, and they are right; it busted the dosbox, and I had to do a repair
reinstall from
the xp cd!. So what was absent was the fourth dummy,yours truly!.
--kurt<wb2...@gmail.com>.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user