Mail Archives: djgpp/1997/03/19/03:54:31
On 17 Mar 1997 23:42:20 GMT, "Thomas Harte" <T DOT Harte AT btinternet DOT com>
wrote:
> Anyway, I want to know, how, in DJGPP, do you shift every value of a
>variable down one in a dimension, ie so that the value at x[n] is written
>to x[n+1], the value at x[n+1] to x[n+2], and so on. I could write a
>for/next routine type thing, but this would be slow. Is there a way similar
>to memcpy ? Like I said, on other compilers because I did not know the
>command, I would just mess with the positions in RAM, but that is not
>something I can get to work under protected mode.
Hmm, for an array A of length L:
memmove(A+1,A,(L-1)*sizeof(A[0]));
memmove differs from memcpy in that it is guaranteed to work for
overlapping blocks such as this. This makes it a little slower, but it
will work in the above case; memcpy merely /might/ :-)
ABW
--
"Plug and Play support: WfEWAD will autodetect any installed
Nuclear Arsenals, Laser Satellites, Battlefield Control Networks,
Radar Installations, Fighter Squadrons, and other WfEWAD compliant
devices, including the new Macrosoft Unnatural Keyboard, with
full support for the now-famous Big Red Buttom(tm)."
(Windows for Early Warning and Defence User's manual P26)
Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.abwillms.demon.co.uk/">Hello :-)</A>
- Raw text -