Raised This Month: $ Target: $400
 0% 

Out of Bounds formatex


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-20-2009 , 01:06   Re: Out of Bounds formatex
Reply With Quote #6

Quote:
Originally Posted by Bad_Bud View Post
I'm making a stupid mistake, but I can't figure out what it is.

Code:
Run time error 4: index out of bounds
For the line below with the formatex

PHP Code:
new WriteTitle[33][25]

...

new 
ItemsNames[1][33]

formatex(ItemsNames[0],32,"Letter: %s",WriteTitle[id]) 
I don't understand how it can be out of bounds. I'm taking a string of size 24 and adding 8 letters to it, then putting it in a max 32 size string. It shouldn't be possible to go over.
Quote:
Originally Posted by Bad_Bud View Post
The function I'm passing it to requires ItemsNames to be two-dimensional -- sometimes I pass in more than one name (NumItems).

PHP Code:
AddItems(id,NumItems,Items[],ItemsNames[][],ItemsModels[][])
{
...

And here's another excerpt from another function right before it calls AddItems (this does not go out of bounds):

PHP Code:
new ItemsNames[1][33]
...
formatex(ItemsNames[0],32,"%s",Temp
If the 2nd doesn't have the error, then it must be from this line:
PHP Code:
formatex(ItemsNames[0],32,"Letter: %s",WriteTitle[id]) 
Where "id" is out of the 33 array bounds.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode