From: "=?iso-8859-1?Q?Veli-Pekka_Kilpel=E4inen?=" To: Subject: Incorrect increment? Date: Mon, 14 Dec 1998 15:34:59 +0200 Message-ID: <01be2766$8b88d320$0a034ac3@vpk2.sci.fi> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0020_01BE2777.4F11A320" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. ------=_NextPart_000_0020_01BE2777.4F11A320 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I don't have a C++ book so try to bear me. I'm having a problem trying to increment a pointer of type unsigned = char. When I use Rhide's debugger and moving step by step(F8) while = monitoring the pointers "value" I see that instead of moving one byte = foward, it'll go three. Here's a cutout from my file: void movemydata(int max, unsigned char *pointertodata) { ... _farsetsel(_dos_ds); for (int index =3D 0; index < max; index++) {if ( (index & 3) =3D=3D 3) {pointertodata++; // yes, I'm trying to skip=20 destinteger++;} // every fourth byte. else {_farnspokeb(destinteger++, *pointertodata); pointertodata++;} // yes, I've put it here to verify=20 }; // I'm incrementing the pointer. ... } It would be nice if you'd answer these too: -Am I getting into trouble when not restoring the original selector? -The size of variables differ from what my tutorial says - integers are = not two bytes long. Does this depend on the enviroment? Mine is PC = Pentium. How do I get one byte long integers? -What will happen if I "overload" my integers trying to put too big = number in it? ------=_NextPart_000_0020_01BE2777.4F11A320 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I don't have a C++ book = so try to=20 bear me.
 
I'm having a problem = trying to=20 increment a pointer of type unsigned char. When I use Rhide's debugger = and=20 moving step by step(F8) while monitoring the pointers "value" = I see=20 that instead of moving one byte foward, it'll go three. Here's a cutout = from my=20 file:
 
void movemydata(int = max, unsigned=20 char *pointertodata)
{
...
_farsetsel(_dos_ds);
for (int = index =3D 0;=20 index < max; index++)
{if ( (index & 3) =3D=3D 3)
 =20 {pointertodata++;   // yes, I'm trying to skip
 =20 destinteger++;}     // every fourth byte.
= else =20 {_farnspokeb(destinteger++, *pointertodata);
 =20 pointertodata++;}   // yes, I've put it here to verify
=20 };           // I'm=20 incrementing the pointer.
...
}
 
 
It would be nice if = you'd answer=20 these too:
-Am I getting into trouble when not restoring the original = selector?
-The size of variables differ from what my tutorial says - = integers=20 are not two bytes long. Does this depend on the enviroment? Mine is PC = Pentium.=20 How do I get one byte long integers?
-What will happen if I=20 "overload" my integers trying to put too big number in=20 it?
 
------=_NextPart_000_0020_01BE2777.4F11A320--