home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12614 < prev    next >
Encoding:
Text File  |  1992-08-21  |  967 b   |  41 lines

  1. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!uicvm.uic.edu!u37956
  2. Organization: University of Illinois at Chicago
  3. Date: Friday, 21 Aug 1992 11:46:05 CDT
  4. From: <U37956@uicvm.uic.edu>
  5. Message-ID: <92234.114605U37956@uicvm.uic.edu>
  6. Newsgroups: comp.lang.c
  7. Subject:  Large memory problem
  8. Lines: 31
  9.  
  10. I am using Ms C 6.0 on DOS5.0 . I have 4MB extented memory.
  11. The following C code is causing me trouble:
  12.  
  13. #include <stdio.h>
  14. main()
  15. ñ int i;
  16.   unsigned char *buffer;
  17.  
  18.   buffer=(unsigned char*)malloc(480000);
  19.   for(i=0; i<480000; i++)
  20.    ñ
  21.        buffer[i]= i%256;
  22.        printf("%u\n", buffer[i]);
  23.    ç
  24. ç
  25.  
  26.  
  27.  
  28.  It is compiled in large(or huge) memory model:
  29.  
  30.      cl /AL myprog.c
  31.  
  32. When I run the program, it prints out the numbers, but in the end, it
  33. gives message" memory allocation error, Can't load COMMAND, the system
  34. halted.", and then the system dies.
  35.  
  36. What's wrong ?
  37.  
  38. Any help will be appreciated.
  39.  
  40. U37956@uicvm.uic.edu
  41.