#Array filling problem
31-Oct-94 09:48:09
Sb: #43594-#Array filling problem
Fm: Jim Nangano/SYSOP 76703,4254
To: Henry Williams 73527,1446
Henry,
The first potential for problem I see is your array allocation — unless
you have set your stack fairly large, you will be using more stack space
than is allocated, which can lead to all kinds of problems. Your data
allocations alone for your main() function are close to 32K, so you will
need to have a stack set to at least 40K or so.
The second potential for a problem would occur _if_ you had a record in
the file where the name element contained 35 characters and no terminating
NULL byte, as your program assumes that this could not occur. This may be a
valid assumption (depending on how you created the data), but if it _might_
not be so, you would be better off using the strncpy() function, and
assuring yourself that the last byte in each array element was a NULL.
Hope this helps….
– BobR
(Motorola Inside!)