69 views
in Embedded Wizard Studio by

Hi Team,

Is there any API is there to print a string with leading Spaces? because currently my team is using this API EwNewStringAnsi() and it automatically remove the leading spaces if any. 

Not sure it is implemented in this way or EW have an additional new API to print the string with leading spaces. Please help us.

Example string:-  "      Testing String"

Regards,

Ayyappan R

1 Answer

0 votes
by

because currently my team is using this API EwNewStringAnsi() and it automatically remove the leading spaces if any. 

The function EwNewStringAnsi() does not remove any spaces. Please review your implementation.

by
Hi Team,
how to use "%-16.16s" this function
Example:-
snprintf(aCalReminder, sizeof(aCalReminder),"%-16.16s%s%s\r\n", "Cal.Reminder", separator, GET_CAL_REM_ALARM_TIME_PERIOD(pstChannelDB->structTempSetup.uc_TempCalRemAlarm_Hrs_Days));
    }                     Value[Number] = EwNewStringAnsi(aCalReminder)
by

The format string "-16.16s" had no other effect than "%s" when I tried it with Visual Studio 2022. Possibly the format combination -16. and 16 is incorrect? I don't know what exact do you expect.

From technical point of view, in Embedded Wizard there is no format sprintf operation. Instead you compose the strings. For example, to get a string with a predefined length you can prefix it with other string containing a predetermined number of blank signs:

// The original string
var string str = "1234";

// Resulting string enlarged to 16 characters by prefixing the
// original string with blank signs
var string result = string( ' ', 16 - str.length ) + str;

For more details, see documentation about string.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...