home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20055 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  2.0 KB

  1. Path: sparky!uunet!olivea!hal.com!darkstar.UCSC.EDU!ucscb.UCSC.EDU!noah
  2. From: noah@ucscb.UCSC.EDU (Noah Spurrier)
  3. Newsgroups: comp.lang.c
  4. Subject: Need info for Turbo-C on storing lots of data within source.
  5. Message-ID: <1jo1ihINNkom@darkstar.UCSC.EDU>
  6. Date: 22 Jan 93 05:43:45 GMT
  7. Organization: University of California; Santa Cruz
  8. Lines: 43
  9. NNTP-Posting-Host: ucscb.ucsc.edu
  10.  
  11.  
  12. Keywords: Turbo C data
  13.  
  14. I have a program that stores a compressed picture of its title screen. The
  15. title screen is a graphic image. Also the program stores some documentation.
  16. The program is fairly short. I do not want to store this data in
  17. separate files. What I did is use HUGE arrays with initialization to the
  18. big chunk of data. This works fine, but I notice that some people have had
  19. the program crash with something like the following error:
  20.  
  21. STACK OVERFLOW
  22.  
  23. or 
  24.  
  25. STACK FULL, SYSTEM HALTED
  26.  
  27. Another person told me that these huge arrays were being stored in the
  28. stack segment and that because they just sit on the stack and never move
  29. this does not give my program much room to work with.
  30.  
  31. Would simply making the array STATIC help things?
  32.  
  33. I also farmalloc a 64K buffer, but I don't think that should hurt the stack
  34. at all. 
  35.  
  36. How can I get Turbo-C to store these variables in the data segment instead of
  37. the stack?
  38.  
  39. Here is an example of how I declare and initialize one of my arrays:
  40. unsigned char far TITLE_DATA [(X_TITLE*Y_TITLE/4)] =
  41. { 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
  42.   85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
  43.   85, 85, 85, 85, 85, 85,117, 85, 85, 85,117, 85, 85, 85,117, 85, 85,213, 85, 85,
  44.   85, 85, 85, 85, 85, 87,213, 85, 85, 87,213, 85, 85, 87,213, 85, 95, 85, 85, 85,
  45.   85, 85, 85, 85, 85,127,213, 85, 85,127, 85, 85, 85,127, 85, 85,255, 85, 85, 85,
  46.   85, 85, 85, 85, 85,255,213, 85, 85,253, 85, 85, 85,253, 85, 87,255, 85, 85, 85,
  47.  
  48. ....
  49. ....};
  50.  
  51. Thanks for even bothering to read this damn thing!
  52.  
  53. noah@ucscb.ucsc.edu
  54.