Skip to content

Using sprintf() instead of strcpy() increases library size for no reason #10

Description

@JM-FRANCE

On an arduino calling sscanf() or sprintf() adds a giant function to the code base. It’s sometimes a necessary evil but in your case you should replace all the
sprintf(xxxxxx,"%s",var1);
by
strcpy(xxxxxx,var1);
As you only copy the string.

Ideally you would make this more robust with strncpy() and taking into account buffer size and the possible needed addition of a trailing ‘\0’

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions