From: "Codey" Newsgroups: comp.os.msdos.djgpp,comp.programming References: <9n2t99$sga$1 AT news DOT telecom DOT cz> Subject: Re: Problem with DJGPP Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Wed, 05 Sep 2001 00:42:10 GMT NNTP-Posting-Host: 203.164.30.25 X-Complaints-To: abuse AT optushome DOT com DOT au X-Trace: news1.rochd1.qld.optushome.com.au 999650530 203.164.30.25 (Wed, 05 Sep 2001 10:42:10 EST) NNTP-Posting-Date: Wed, 05 Sep 2001 10:42:10 EST Organization: @Home Network To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Rene" wrote in message news:9n2t99$sga$1 AT news DOT telecom DOT cz... > What do I do wrong when the program built in DJGPP exits with General > protection fault error? For example, this occurs when using the fread() from > stdio.h, when I want to put pixel directly into the video memory > (0xa0000000), etc. In TC++ 3.1 everything goes well. > I would appreciate any help. > Rene Puchinger 0xa000000 is a selector in PM, welcome to PM, TC++ is real mode which is why it works, to get around this in DJGPP you can use this code: #include // to init __djgpp_nearptr_enable(); vRam = (unsigned char *)(__djgpp_conventional_base + 0x0a0000); // and when you're finished __djgpp_nearptr_disable(); I suggest you do some more reading in the FAQ and about __djgpp_conventional_base etc. HTH Ray.