delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/13/17:23:09

Newsgroups: comp.os.msdos.djgpp
Date: Mon, 13 Sep 1999 18:37:23 +0300
From: Mikko Lehtonen <scorpion AT sgic DOT fi>
Subject: 1. Win98 2. bug?
Message-ID: <Pine.OSF.4.10.9909131820530.25729-100000@Platon.sgic.fi>
MIME-Version: 1.0
NNTP-Posting-Host: platon.sgic.fi
Lines: 81
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

	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<size) {
    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.
-------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019