![]() You need to read the value as an unsigned (short) int first (or uint(16|32)_t, if you like), then you can truncate it to uint8_t. So when I do uint8_t myInt = Cast("123") Log(LOG_LEVEL::LERROR, "XMLCast failed to cast ", str, " to ", typeid(value).name()) Here is the cast function I use: template Let say I set the input string "123", my returned value will be 49 (the ASCII code of '1')Īs I use templated functions to make the casts, I'd like to make as few changes to the code as possible (of course). My problem is that uint8_t is considered as a char so the cast returns only the first character of the string. ![]() Hence I use uint8_t to store those values and stringstream to get/set the value from/to a string. Watch Vice Versas brand new music video for 'CAST ØUT' EXCLUSIVELY on CaliberTVDirected by Jack HallerInstagram: diaProduced, mixed and mastered. ![]() I am making a GUI for images edition and I need to display and handle RGB values from the user.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |