I am looking for a solution how to get a filled spot in the string when I send the 0x00 value.
as an example, by sending the value hexToASCII("6765656b73") I get the string "geeks". But when I send the value hexToASCII("0065006b73") I get only the string "eks", the 00 do not even count. Is there something I can add to fill the spots in the string, which has the same value as ASCII NUL? Thanks a lot in advance..
// C++ program to convert hexadecimal
// string to ASCII format string
#include <bits/stdc++.h>
using namespace std;
string hexToASCII(string hex)
{
    // initialize the ASCII code string as empty.
    string ascii = "";
    for (size_t i = 0; i < hex.length(); i += 2)
    {
        // extract two characters from hex string
        string part = hex.substr(i, 2);
 
        // change it into base 16 and
        // typecast as the character
        char ch = stoul(part, nullptr, 16);
 
        // add this char to final ASCII string
        ascii += ch;
    }
    return ascii;
}
 
// Driver Code
int main()
{
    // print the ASCII string.
    cout << hexToASCII("6765656b73") << endl;
 
    return 0;
}
 
    