352 views
in System Integration by

Hello EW Team,

I have a text input field in emwi.

When you press the "Finish" button, the entered text is saved in Device::Device.TestMessage and passed to my external variable.

Now I have my variable in my C code, see "XString TestMessage".

The TestMessage is now processed below.

The Line, because the picture is out of focus:

sprintf(msg, "[{\"Starttime:\": \"%s\"},{\"Endtime:\": \"%s\"},{\"Duration:\": \"%s\"},{\"Successful:\": \"%s\"},{\"Message:\": \"%S\"}]}]", startdate_buffer, enddate_buffer, duration_buffer, testsucces, TestMessage);

However, the "\n" characters are not written down.

How can I solve the problem that the "\n" characters are also there?

 

Best regards

Justin

1 Answer

0 votes
by
 
Best answer

Okay, i found my problem.

 

It was the %S, it must be a %s.

So:

sprintf(msg, "[{\"Starttime:\": \"%s\"},{\"Endtime:\": \"%s\"},{\"Duration:\": \"%s\"},{\"Successful:\": \"%s\"},{\"Message:\": \"%s\"}]}]", startdate_buffer, enddate_buffer, duration_buffer, testsucces, TestMessage);

Best regards

Justin

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...