Home AMX Technical Discussion

concatenate issue

johnbonz1johnbonz1 Posts: 47
edited October 26 in AMX Technical Discussion

question why does this not concatenate properly?

I have a string

part1Str LEN = 71
part1Str = Authorization: Digest username=admin,realm=Avigilon-112008310210,nonce=

part2Str LEN = 46
part2Str = DNTq7Z1hfR1UxPrdYS3l92ljZ8clQfHsfmWP295c0b0000

part3Str LEN = 35

part3Str = ,uri=/onvif/device_service,gop=auth

then I concatenate each var above to final string variable called finalStr

finalStr LEN = 71
finalStr = Authorization: Digest username=admin,realm=Avigilon-112008310210,nonce=

finalStr LEN = 117
finalStr = Authorization: Digest username=admin,realm=Avigilon-112008310210,nonce=DNTq7Z1hfR1UxPrdYS3l92ljZ8clQ

finalStr LEN = 152
finalStr = Authorization: Digest username=admin,realm=Avigilon-112008310210,nonce=DNTq7Z1hfR1UxPrdYS3l92ljZ8clQ

See the string from
part2Str = DNTq7Z1hfR1UxPrdYS3l92ljZ8clQfHsfmWP295c0b0000

get truncated when I concatenatre to finalSTR-- DNTq7Z1hfR1UxPrdYS3l92ljZ8clQ

why is that?

Comments

  • What language we are talking about? This doesn't look NetLinx language

  • johnbonz1johnbonz1 Posts: 47
    edited October 27

    The language is NetLinx Studio
    I will beak it out better

    local_var char part1Str[128];char part2Str[128];char part3Str[128]; char finalStr[1024];

    part1Str = Authorization: Digest username=admin,realm=Avigilon-112008310210,
    part1Str LEN = 65

    part2Str = nonce=6xeTM9l9I78GRrXUgRnkjDx70nFMLv6hQzYS2Tdb020000
    part2Str LEN = 52

    part3Str = ,uri=/onvif/device_service,gop=auth
    part3Str LEN = 35

    Now I concatenate variables part1Str,nonceStr,part3Str into var finalStr

    finalStr = "part1Str,nonceStr,part3Str";

    finalStr LEN = 152
    result is below - note how after 100 bytes its cut off but when I do itoa(length_string(finalStr) value is 152

    finalStr = Authorization: Digest username=admin,realm=Avigilon-112008310210,nonce=6xeTM9l9I78GRrXUgRnkjDx70nFML

    what I expected is this: 152 bytes
    Authorization: Digest username=admin,realm=Avigilon-112008310210,nonce=6xeTM9l9I78GRrXUgRnkjDx70nFMLv6hQzYS2Tdb020000,uri=/onvif/device_service,gop=auth

  • When checking in the debugger, as long as the total length is 152, everything is ok.

    If you verify this by Diagnostics or send_string 0, the string will be truncated in the output. Here you have to split the string into parts, you may use the attached function

Sign In or Register to comment.