TLV library in C

Nov 12, 2022 at 11:40am
Hello everyone!!

Does anyone know about a TLV library in C?

I have to write the contents of some buffer into disk using TLV format.

Thanks in advance!
Nov 12, 2022 at 4:44pm
Simply amazing what searching the internet can find:

GitHub - pcboy/libtlv: A TLV library in C
https://github.com/pcboy/libtlv

The DDG meta-search I used to find that link:

https://duckduckgo.com/?q=TLV+library+in+c&t=ffsb&ia=web

Another TLV library that provides encodings for multiple languages:

https://github.com/Jhuster/TLV

Maybe next time you should try searching before you ask, please. I had no clue what TLV is, never use it, so I searched and found out.
Nov 12, 2022 at 5:24pm
Like George, I have not had to use one and cannot recommend one random google result over another. Its always tough when you have a lot of choices -- I even found a TOP 20 page so you certainly have your work cut out deciding which one to use. Be aware that the type codes and exact details (endian, etc) may vary across implementations so if you need to talk to another program that uses it, you need to use the same library or the same encoding at least. If you get to decide both ends, its a lot easier, you don't even need a library, just make up your type code table & 3 or 4 lines would be done with it. Given the simplicity, I would probably do that to avoid a dependency you don't need.
Last edited on Nov 12, 2022 at 5:25pm
Topic archived. No new replies allowed.