Home AMX User Forum NetLinx Studio

Stuck on CHAR arrays again

Thanks so much to everyone that helped me out on my earlier post about CHAR arrays (http://www.amxforums.com/showthread.php?t=2205). I thought I had this more or less figured out, but now I've run into something else that doesn't quite make sense...

For a 16 output Autopatch switch, I've defined a variable CHAR vsw_out[30]. I figured 30 characters should be plenty to account for a handful of active outputs and the spaces that go between them when you actually send the command to the switch (I've actually only used 7 character positions so far). I've got all my ports mapped in DEFINE CONSTANT like projector1 = 5, polycom = 6, etc. I'm also using ELO touchpanels, and those ports are defined as tp1 = 1, tp2 = 2, etc. My touchpanel design 4 video previews that show up on the ELO, and any one of them can be selected as "active". I've got a selection variable for that (active_port), and an array that maps the selection variable to a port (port_map[] = {1,2,3,4}).

Almost everywhere I assign vsw_out to something - usually several ports like:
vsw_out = "itoa(projector1),' ',itoa(tp1),' ',itoa(polycom)"
... or a single port via the active panel array like:
vsw_out = "itoa(port_map[active_port])"
... I get no compile errors - everything seems fine.

But now I've just created another assignment for just the single projector port, like this:
vsw_out = "itoa(projector1)"
... and I keep getting a compile "ERROR: Illegal assignement statement" message. I don't understand why the itoa(projector1) doesn't give an error when it's combined with other stuff as in the first code snippet, and a different single-port assignment also doesn't give an errror as in the 2nd code snippet, but I am getting an error in the 3rd code snippet.

Please, can someone tell me what foolish Newbie mistake I'm making this time?

Thanks,

Comments

  • This compiles fine for me:
    program_name='xxx'
    
    define_constant
    
    integer i = 1
    
    define_variable
    
    char s[10]
    
    define_start
    
    s = "itoa(i)"
    
  • Yeah, I think I must have a mistake like an errant " somewhere else in my code, and it's just provoking the error on that line. Thanks for the confirmation that it should compile OK.
  • DHawthorneDHawthorne Posts: 4,584
    Check the lines prior, sometimes the compiler error messages are off a line or two. What I generally do if there is any question exactly where the error is is to comment out the whole block, then start uncommenting sections to narrow it down.
  • Thanks Dave! It was the line above - very similar but I forgot the "itoa()" wrapper on that one. Now I'm wondering why I didn't define all those port maps as CHAR to begin with...
Sign In or Register to comment.