home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!hal.com!darkstar.UCSC.EDU!ucscb.UCSC.EDU!noah
- From: noah@ucscb.UCSC.EDU (Noah Spurrier)
- Newsgroups: comp.lang.c
- Subject: Need info for Turbo-C on storing lots of data within source.
- Message-ID: <1jo1ihINNkom@darkstar.UCSC.EDU>
- Date: 22 Jan 93 05:43:45 GMT
- Organization: University of California; Santa Cruz
- Lines: 43
- NNTP-Posting-Host: ucscb.ucsc.edu
-
-
- Keywords: Turbo C data
-
- I have a program that stores a compressed picture of its title screen. The
- title screen is a graphic image. Also the program stores some documentation.
- The program is fairly short. I do not want to store this data in
- separate files. What I did is use HUGE arrays with initialization to the
- big chunk of data. This works fine, but I notice that some people have had
- the program crash with something like the following error:
-
- STACK OVERFLOW
-
- or
-
- STACK FULL, SYSTEM HALTED
-
- Another person told me that these huge arrays were being stored in the
- stack segment and that because they just sit on the stack and never move
- this does not give my program much room to work with.
-
- Would simply making the array STATIC help things?
-
- I also farmalloc a 64K buffer, but I don't think that should hurt the stack
- at all.
-
- How can I get Turbo-C to store these variables in the data segment instead of
- the stack?
-
- Here is an example of how I declare and initialize one of my arrays:
- unsigned char far TITLE_DATA [(X_TITLE*Y_TITLE/4)] =
- { 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 85,117, 85, 85, 85,117, 85, 85, 85,117, 85, 85,213, 85, 85,
- 85, 85, 85, 85, 85, 87,213, 85, 85, 87,213, 85, 85, 87,213, 85, 95, 85, 85, 85,
- 85, 85, 85, 85, 85,127,213, 85, 85,127, 85, 85, 85,127, 85, 85,255, 85, 85, 85,
- 85, 85, 85, 85, 85,255,213, 85, 85,253, 85, 85, 85,253, 85, 87,255, 85, 85, 85,
-
- ....
- ....};
-
- Thanks for even bothering to read this damn thing!
-
- noah@ucscb.ucsc.edu
-