TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Chris Mackenzie
from: David Nugent
date: 1995-07-31 05:26:12
subject: What is Happening Here ?

> I'm having a small problem that is proving to be rather anoying....
 > I know I must have done somthing wrong pointer-wise but I
 > just can't see it.

 > struct batdata *bat_data;

You don't provide the definition of struct batdata.


 >     for(cnt = 0; cnt <17; cnt++)
 >     {
 >         sprintf(bat_data->label,"Item %02d",cnt+1);
 >         strcpy(bat_data->desc,desc);

Are you sure that batdata::desc is large enough to contain all of the
characters in 'desc' AS WELL AS the trailing NUL?


 > Now when this is compiled & run it outputs the following..

 > Label: 'Item 01'
 >  Desc: '12345678901234567890123456789012345c:batch'
 > batch: 'c:batch'

 > I just dont't see where I've stuffed the pointer up ! *8-/

Not really a pointer problem - you probably just need to increase the size
of batdata::desc by 1 more character.

  David

---
* Origin: Unique Computing, Melbourne, Australia (3:632/348)
SEEN-BY: 50/99 620/243 623/630 632/103 348 998 633/371 634/384 388 635/301
SEEN-BY: 635/502 503 544 727 636/100 639/100 711/401 409 410 430 510 807 808
SEEN-BY: 711/809 932 934 712/515 713/888 714/906 800/1 7877/2809
@PATH: 632/103 348 635/503 50/99 711/808 809 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™.