Hi there,

I want to write a function as a plugin to convert a 4 byte hex string like "405f612f" to float/double (3.49031 in this case).

An easy way to do so in C++ is this:

#include<sstream>

union  ulf
{
    unsigned  long  ul;
    float  f;
};

int  main()
{
    ulf u;
    string str ="405f612f";
    stringstream ss(str);
    ss >> hex >> u.ul;
    float  f = u.f;
    cout << f << endl;
}

Unfortunatly, to use "stringstream" I will have to include the <sstream> header file. Is this possible to do in plugin functions?

Thanks.

Dane

_______________________________________________
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev

Reply via email to