Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wakaama-dev] Junk characters while accepting package URI in firmware object

Thanks Achim!

On 3 September 2015 at 12:28, Kraus Achim (INST/ESY4) <Achim.Kraus@xxxxxxxxxxxx> wrote:
Hi Ashish,

> When I try to print it on console I see some junk characters at the end,  can any one please guide me how do I fix it.

When something "print"ed in C ends with junk characters, it's mostly not a \000 terminated string!

To fix it, make a buffer with at least the length of the data +1 byte for the \000 termination.
(The length of the data is stored in "dataArray[i].length".)
Copy the data and terminate it with the \000. Then you can do a printf.
Alternatively just print the char each by each.
Or use the "output_buffer" function in "commandline.h"
("output_buffer(STDOUT, dataArray[i].value, dataArray[i].length, 0);" but you will get also the hex-dump).

Mit freundlichen Grüßen / Best regards

Achim Kraus

Bosch Software Innovations GmbH
Communications (INST/ESY4)
Stuttgarter Straße 130
71332 Waiblingen
GERMANY
www.bosch-si.de
www.blog.bosch-si.com

achim.kraus@xxxxxxxxxxxx

Registered office: Berlin, Register court: Amtsgericht Charlottenburg, HRB 148411 B
Executives: Dr.-Ing. Rainer Kallenbach; Michael Hahn


Von: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] Im Auftrag von Ashish Yadav
Gesendet: Donnerstag, 3. September 2015 08:21
An: wakaama-dev@xxxxxxxxxxx
Betreff: [wakaama-dev] Junk characters while accepting package URI in firmware object

Hi,
I wakaama test client in object_firmware.c file,  in prv_firmware_write I am assigning PACKAGE_URI from leshan server as below
PACKAGE_URI =dataArray[i].value;
When I try to print it on console I see some junk characters at the end,  can any one please guide me how do I fix it.
Also,  below are some of the input which I give from leshan server in which junk characters doesn't show up but apart from the below anything sent has junk characters at the end.
Input from Leshaan server to wakaama client for package uri
1. Ftp://root:Newuser123@10.20.8.47/intel.img
2.  Ftp://root:Newuser123@10.20.8.47/iTunes.Exe
I don't know why the above two doesn't get postfixed by junk characters,  else anything I send it has junk characters at the end.
Any guidance and help on this is highly appreciated.
_______________________________________________
wakaama-dev mailing list
wakaama-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/wakaama-dev



--

Thanks & Regards,

Ashish Yadav

Phone: +91- 9867349433| ashish.9433@xxxxxxxxx | Skype: ashish.9433
Website: http://heart-hackers.com || Blog: http://tech.heart-hackers.com

Back to the top