Home AMX User Forum AMXForums Archive Threads Tips and Tricks

CHAR array as parameter with WAIT

Hi,

I have a function that I want to pass a CHAR array into it as a parameter and then do a SEND_COMMAND in a wait statement. I am getting an error saying that "all bounds of the array must be defined to be used in a wait" (something to that effect)

Need advice on how to accomplish this?

Thanks,

Comments

  • viningvining Posts: 4,368
    I beleive that means
    DEFINE_FUNCTION fnWebPageParseContent (CHAR strIncoming[30000], CHAR strIncomingIP[20])
     vs
    DEFINE_FUNCTION fnWebPageParseContent (CHAR strIncoming[], CHAR strIncomingIP[])
    

    Then I guess you can use a parameter in a wait. Of course since the paramter is passing by reference the value may not be what you expect when the wait time expires and your code runs.
  • ericmedleyericmedley Posts: 4,177
    I ran into this. I had to use a local var and make it equal to the referenced array cell right befor declaring the wait.

    Something like
    Local_var integer wait_temp;
    wait_temp=myWaits[zone_id]
    wait wait_temp{
      // do something
      }
    
    
  • viningvining Posts: 4,368
    Especially if you use stack_vars as a parameter to pass to your funuction which then uses that parameter in a wait. You won't throw the normal compiler error, can't use a stack_var in wait, but that's affectively what you're doing.
  • vining - That works, thanks for the tip. I didn't know you could do that with parameters.
Sign In or Register to comment.