Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strings are always read a fixed length #420

Open
RobertoRoos opened this issue Sep 13, 2024 · 0 comments
Open

Strings are always read a fixed length #420

RobertoRoos opened this issue Sep 13, 2024 · 0 comments

Comments

@RobertoRoos
Copy link
Contributor

RobertoRoos commented Sep 13, 2024

Another one for the pile of string related issues: it looks like strings are read at a fixed 1024 characters in e.g. plc.read_by_name():

# pyads_ex.py:
    if type_is_string(data_type):
        data = (STRING_BUFFER * PLCTYPE_STRING)()
# constants.py:
STRING_BUFFER: int = 1024

Which seems unnecessary because the returned type of a string looks like "STRING(80)" and would contain the right size perfectly fine.

EDIT: Same for WSTRING (which is double-byte USC-2 encoded)

@RobertoRoos RobertoRoos changed the title Strings are read a fixd length Strings are always read a fixed length Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant