From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: 1. Win98 2. bug? Date: Mon, 13 Sep 1999 13:12:43 -0700 Organization: Harvey Mudd College Lines: 90 Message-ID: <37DD5ABB.736FDCBD@hmc.edu> References: NNTP-Posting-Host: mercury.st.hmc.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: nntp1.interworld.net 937253554 4520 134.173.45.219 (13 Sep 1999 20:12:34 GMT) X-Complaints-To: usenet AT nntp1 DOT interworld DOT net NNTP-Posting-Date: 13 Sep 1999 20:12:34 GMT X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.12pre4 i586) 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 Mikko Lehtonen wrote: > > Hello! > > I have two things: > > 1. > I code in win98 dosbox quite happily, without problems etc. but then I > tried in clean win98 dos.. (dos7?) without the gui loaded, and a problem > raised! > first it told me that there's no dpmi. ah okey, I forgot this, I > put cwsdpmi in the dir.. the machines hangs.. and with little more poking, > I find that every time I trie to use cwsdpmi, my machine hangs! (no, not > in win98 dosBOX when it says protected mode not accesible, which is > because of win98's dpmi service ?) > has microsoft done a another stupid mistake or have I missed something? > > 2. > > I have this program that moves couple of cool lights around on the screen, > and then I pondered, that a background could be cool.. so I wrote a fast > opentga routine which wasn't completely ripped, but it was some.. > the strangest thing happened when playing around with this code! > fclose(fp); doesn't work, it crashes the program, free(backg); doesn't > work, crashes the program, and if I have neither of them, it crashes in > the end anyways. > > small peezes of code: > (its in vesa2 btw.) > > unsigned int *backg; > unsigned int *loadtga(char *filename, int size) { > unsigned char r,g,b; > int i=0; > FILE *fd; > unsigned int *p; > fd=fopen(filename,"rb"); > printf("%d\n",fd); > fflush(stdout); > if(!fd) { printf("couldn't open file %s!\n",filename); exit(0); } > fseek(fd,18,SEEK_SET); > p=calloc(size,sizeof(int)); > if(!p) { printf("calloc failed in loadtga!\n"); exit(0); } > while(!feof(fd) || i b=fgetc(fd); > g=fgetc(fd); > r=fgetc(fd); > p[i++]=(r<<16)+(g<<8)+b; > } > printf("%d\n",fd); > fflush(stdout); > fclose(fd); > return p; > } > > int main(...) { > > backg=loadtga("backgrnd.tga",640*480); > > while(!kbhit()) { > ... > } > > free(backg); > > } > > What is wrong?? > > ps. > please try to answer as email atleast! I don't read this newgroup that > often! > > - Scorpion - scorpion AT sgic DOT fi - www.sgic.fi/~scorpion - > ------------------------------------------------------- > Experience is something what you can't get until just > after you need it. > ------------------------------------------------------- -- Nate Eldredge neldredge AT hmc DOT edu