| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | help |
G'Day Jahmai,
-=> Quoting Jahmai Lay to All <=-
JL> Hello all, Help needed here, when using QuickC, i
JL> have lotsa indexed chars like;
JL> char l_name[200][35];
JL> about 15 or so times, so when i compile i get some
JL> "Exceeded 64k Limit" error about memory, how to I fix
JL> this?, I have read about "huge" being able to retard this
JL> limit but i have no idea of how to use it. Please help.
Oh, i remember this was fun, i still dig out my notes when i do it,
straight after the boot:)
You can not allocate larger than 64Ks locally, in other words it'll
either have to be a global variable, or static.
I did not test any of these, so go easy on me...
Eg, You can have..
char huge Array[200][35]; this is roughly 70000 bytes of course.
main()
{
strcpy(Array[0],"myarray's #0 element");
...
}
but not..
main()
{
char huge Array[200][35]; /* error */
unless you have..
static char huge Array[200][35]; /*this is good, but same as a global*/
}
There is another note, the elements' sizes should be a power of 2, so
they wouln't overlap segment boundaries.
so ideally it should be changed to char huge Array[200][64];
Dynamically allocating is probably better, it goes something like this..
assume:
long maxarray = 100L; /* number of elements */
long size = 64L; /* size of each element */
For a single array, which is not what you want.
char huge *Array = (char huge*) farmalloc((long)size);
For a multi array, which IS what you want.
char huge* Array[100] = (char huge*) farmalloc((100L * size));
then when in need of more elements..
maxarray += 100L;
Array = (char huge*) farrealloc(Array,(maxarray*size));
If you realloc() , do not change the size of the elements, that will
corrupt the data previously there.
Your compiler may or may not need the casts, and it may not have
farmalloc(), in that case i don't have a clue what to do.
Another thing i remember that in the IDE these huge allocs won't work
properly, as the IDE runs out of memory. So it's a constant shell to
DOS and test the exe, and then back to the IDE sort of fun.
JL> Just something else while i'm here, does anyone have any quick modem
JL> comport routines? As in i need them for a small door i want to
Sorry, haven't played with com ports yet, but check out serial.c and
serial.h in SNIPPETS.
L8r Frank (fadam{at}ozemail.com.au).
___ Blue Wave/DOS v2.21
--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 711/401 409 410 413 SEEN-BY: 711/430 808 809 932 934 712/515 713/888 714/906 800/1 @PATH: 635/544 50/99 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.