Mail Archives: djgpp/2000/04/21/15:55:34
From: | Bernhard Stiftner <stiftnersoftwareNOstSPAM AT gmx DOT net DOT invalid>
|
Subject: | Arrays in C or a completely new way to restart your PC ;-)
|
Newsgroups: | comp.os.msdos.djgpp
|
Message-ID: | <0fd549f4.922d8d61@usw-ex0110-075.remarq.com>
|
Lines: | 53
|
Bytes: | 1740
|
X-Originating-Host: | 195.3.96.211
|
Organization: | http://www.remarq.com: The World's Usenet/Discussions Start Here
|
X-Wren-Trace: | eE5rQ0JbHFYdHU5PTRpBQk5OUU1fXQ9KTmJGQF8UWQtVCF8WFUAIDhsZBBkRXw==
|
Date: | Fri, 21 Apr 2000 11:39:48 -0700
|
NNTP-Posting-Host: | 10.0.2.75
|
X-Complaints-To: | wrenabuse AT remarq DOT com
|
X-Trace: | WReNphoon3 956339922 10.0.2.75 (Fri, 21 Apr 2000 10:58:42 PDT)
|
NNTP-Posting-Date: | Fri, 21 Apr 2000 10:58:42 PDT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi everyone...
Now, please dont't laugh. I've found an effective way to
reboot a PC (even when running Windows), although I just
wanted to declare an array in C ;-) ...
No, honestly, I've really got some troubles with arrays in
C (I know that this does perhaps not fit into a DJGPP
newsgroup, sorry, but I think (or at least I hope) that
somebody could help me here, too (please!!!)...).
I wanted to set up an array of pointers to some BITMAP
structures of Allegro:
BITMAP *ani1[5]; /* I think this sets up an array of 6
pointers (ranging von 0 to 5) to these BITMAPs */
PALLETE junk;
void load_animation(void) { /* load the files ANI000.BMP to
ANI005.BMP into the array */
int i;
char *str;
char *buf;
char *fname;
for (i=0; i<6; i++) {
itoa(i-1, str, 10);
buf = strcat("ani100", str);
fname = strcat(buf, ".bmp");
ani1[i] = load_bitmap(fname, junk);
}
}
void unload_animation(void) {
int i;
for (i=0; i<6; i++) {
destroy_bitmap(ani1[i]);
}
}
/* ... and so on ... */
So, I don't know what's wrong with my code...
PS: I'm currently trying to teach C/C++ myself (not an easy
task - after all, I'm a 15 years old student and I have to
invest ***huge*** amounts of time in school (although I try
to reduce that to the absolute minimum...)), so I hope you
understand that I'm having some problems with C/C++ [after
I've got used too much to really easy things like pascal...]
PPS: Feel free to use my code in your own programs - that's
really useful stuff!!! :-)
PPPS: Don't laugh!!!
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
- Raw text -