Strings longer than 255 characters

Discussion in 'C-Bus Wiser 2 Controller' started by Matt, Apr 4, 2016.

  1. Matt

    Matt

    Joined:
    Aug 3, 2004
    Messages:
    27
    Likes Received:
    2
    Location:
    Cairns North Queensland
    A question for all the logic/pascal gurus out there.

    Is there any way of storing strings longer than 255 characters ?
    I am trying to send IR commands over a ip socket to a IR Blaster but I am stuck as the commands i need to send are over 1000 characters long .

    E.g

    Dakin18DegOn = 'sendir,2:1,10,37091,1,1,128,64,16,48A16,16,16,16,16,16A16,16,16,16,16,16,16,16A16,16A16,48,16,16A16,48A16,48A16,16,16,16A16,16,16,16,16,16,16,16,16,16,16,16A16,48A16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16A16,16,16,16,16,16,16,16,16,16,16,16,16,1100,128,64A16,16,16,16,16,16A16,16,16,16,16,16,16,16A16,16A16,48,16,16A16,48A16,48A16,16,16,16A16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16A16,16,16,16,16,16A16,48,16,16,16,16,16,16,16,16A16,16,16,16A16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16A16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16A16,48,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16A16,48A16,16,16,16,16,16,16,16A16,4747' ;

    results in "Error C266 - String constant too long"
     
    Matt, Apr 4, 2016
    #1
  2. Matt

    rhamer

    Joined:
    Aug 3, 2004
    Messages:
    673
    Likes Received:
    3
    Location:
    Melbourne, Australia
    Why not just break it up into several smaller strings, then send them one after another.

    I obviously don't know the specifics of the device your talking to, but I would try that as a simple solution first.

    Cheers

    Rohan
     
    rhamer, Apr 4, 2016
    #2
  3. Matt

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    Build them up at run-time using the append command:

    Code:
    // Global Variables
    bigString: array[0..2000] of char;
    
    //Initialization
    bigString := 'sendir,2:1,10,37091,1,1,128,64,16,48A16,16,16,16, 16,16A16,16,16,16,16,16,16,16A16,16A16,48,16,16A16 ,48A16,48A16,16,16,16A16,16,16,16,16,16,16,16,16,1 6,16,16A16,48A16,48,16,';
    append(bigString,'16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16 ,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,1 6,16,16,16,16,16,16A16,16,16,16,16,16,16,16');
    append(bigString, ',16,16, 16,16,16,1100,128,64A16,16,16,16,16,16A16,16,16,16 ,16,16,16,16A16,16A16,48,16,16A16,48A16,48A16,16,1 6,16A16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,');
    etc etc.
     
    Ashley, Apr 4, 2016
    #3
  4. Matt

    Matt

    Joined:
    Aug 3, 2004
    Messages:
    27
    Likes Received:
    2
    Location:
    Cairns North Queensland
    Thanks for that and Thanks for the quick reply
     
    Matt, Apr 5, 2016
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.