关于crypto++,高手请进
string* InformationDisperseFile(int threshold, int nShares, const char *filename)
{
assert(nShares<=1000);
string* ret = new string[nShares];
ChannelSwitch *channelSwitch;
StringSource source(filename, false, new InformationDispersal(threshold, nShares, channelSwitch = new ChannelSwitch));
vector_member_ptrs<StringSink> stringSinks(nShares);
string channel;
for (int i=0; i<nShares; i++)
{
char extension[5] = ".000";
extension[1]='0'+byte(i/100);
extension[2]='0'+byte((i/10)%10);
extension[3]='0'+byte(i%10);
stringSinks[i].reset(new StringSink((string(filename)+extension)));
channel = WordToString<word32>(i);
stringSinks[i]->Put((byte *)channel.data(), 4);
channelSwitch->AddRoute(channel, *stringSinks[i], BufferedTransformation::NULL_CHANNEL);
StringSource source(stringSinks[i],true, new StringSink(ret[i]));//出现错误,是参数1的类型问题,不知道怎么改?
}
source.PumpAll();
return ret;
}
void main()
{ char*str = "11111111111112222222222233333333333";
string* m = InformationDisperseFile(50, 100, str);
for(int i=0; i<100; i++)
{
cout<<m[i]<<endl;
}
getchar();
}
请高手帮助,很是着急啊!