| delorie.com/archives/browse.cgi | search |
| From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Pointer/array understanding? |
| Date: | Sat, 06 Oct 2001 19:56:40 +0200 |
| Lines: | 23 |
| Message-ID: | <3BBF45D8.D422F37E@is.elta.co.il> |
| References: | <34539894 DOT 0110051212 DOT 1cb9a48e AT posting DOT google DOT com> <34539894 DOT 0110060928 DOT 61680041 AT posting DOT google DOT com> |
| NNTP-Posting-Host: | 192.116.55.139 |
| Mime-Version: | 1.0 |
| X-Trace: | fu-berlin.de 1002390979 20489767 192.116.55.139 (16 [61365]) |
| X-Mailer: | Mozilla 4.7 [en] (Win98; I) |
| X-Accept-Language: | en |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
pouzzler wrote:
>
> for(int i=0; i<bitmap.bmih.biClrUsed; i++)
> {
> _read(hbitmap, &bitmap.bmiColors[i].rgbBlue, 1);
> _read(hbitmap, &bitmap.bmiColors[i].rgbGreen, 1);
> _read(hbitmap, &bitmap.bmiColors[i].rgbRed, 1);
> _read(hbitmap, &bitmap.bmiColors[i].rgbReserved, 1);
> }
>
> _close(hbitmap); //closing the file
> }
>
> It crashes when reading in RGBQUAD *bmiColors
>
> But only with djgpp - compiling and running it using VC++ works fine.
>
> Does anyone know why?
Because you didn't allocate the storage where bitmap.bmiColors[] point?
The fact that MSVC-compiled program works doesn't mean anything--except,
perhaps, that DJGPP has a better run-time diagnostics.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |