fbarresi / BeckhoffHttpClient

Unofficial TwinCAT function for HTTP-Client and Json conversion
MIT License
63 stars 9 forks source link

String variable 'in' too short for the VAR_IN_OUT parameter #4

Closed ramonneves closed 4 years ago

ramonneves commented 4 years ago

Hello! When I'm trying to compile, I get the following errors in the HttpClient POU:

String variable 'in' too short for the VAR_IN_OUT parameter 'Body' of 'F_STRING' String variable 'in' too short for the VAR_IN_OUT parameter 'Address' of 'F_STRING' String variable 'in' too short for the VAR_IN_OUT parameter 'CallMethod' of 'F_STRING' String variable 'in' too short for the VAR_IN_OUT parameter 'ResponseCode' of 'F_STRING' String variable 'in' too short for the VAR_IN_OUT parameter 'Response' of 'F_STRING'

fbarresi commented 4 years ago

Hi!

This is an error in the function F_STRING of the Tc2_Utilities Library used for formatting the parameters.

It is explained here: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/36028799547735179.html&id=

Look at the example at the bottom of the page.

Best regards!

ramonneves commented 4 years ago

Hello!

Thanks for your answer. I solved the problem inserting the uncompiled code in my project and changing the VAR_INPUT of type STRING to STRING(MAX_STRING_LENGTH).

Regards!

fbarresi commented 4 years ago

Hi! You are welcome!

Please, be careful with this stuff... Why? Sadly are command line arguments under beckhoff limited to 255 chars. I decided to limit every parameter to a string or string(80) because thy are combined into a T_MaxString in order to keep the arguments under the limit of 255 chars.

So if your arguments are a full STRING(MAX_STRING_LENGTH) they will be cut.

Best regards.