07 Jan, 2011, Rojan QDel wrote in the 1st comment:
Votes: 0
Many muds have a print_bitvector function to convert bitvectors to a string for writing to a file. Does anyone have a snippet that can do the opposite (not fread_bitvector)? I am looking to convert a string from a database into a bitvector.

Thanks!
07 Jan, 2011, Rojan QDel wrote in the 2nd comment:
Votes: 0
Scratch it, I found the function I wrote for this purpose years ago and thought I lost.. If anyone is curious:
/*
* Read an extended bitvector from an input - Rojan
*/
EXT_BV get_bitvector( char * input )
{
EXT_BV ret;
int z, x = 0;
int num = 0;
memset( &ret, '\0', sizeof(ret) );

char ** loop = explode('&',input);
for (int z = 0; loop[z] != NULL; z++)
{
num = atoi(loop[z]);
if ( x < XBI )
ret.bits[x] = num;
++x;
}


return ret;
}
0.0/2