encrypt filenames program



can anyone tell me why this program doesn't work if you give filenames
with a "space line space".. like
file - 2005.bzip

here it is:

#include <fstream>
#include <iostream>
//cryptopp libraries
#include <cryptopp/osrng.h> //needed for AutoSeededRandomPool
#include <cryptopp/modes.h>
#include <cryptopp/blowfish.h>
#include <cryptopp/filters.h>

using namespace std;
using namespace CryptoPP;

int main()
{

cout<<"//////////////////////////////"<<endl;
cout<<"rename with filename encryption/decryption"<<endl;
cout<<"CTRL+C to exit"<<endl;
cout<<"//////////////////////////////"<<endl;

//ENCRYPT FILENAME

string infilename;
string outfilename;
cout <<"Enter filename of file to encrypt or decrypt: ";
cout<<"\n";
cin >>infilename;
cout<<"\n";
ifstream input(infilename.c_str());

AutoSeededRandomPool rng;
string key(Blowfish::DEFAULT_KEYLENGTH, 0);
string iv(Blowfish::BLOCKSIZE, 0);// this is the Initialization
Vecktor

cout<<"enter the password..(12 charachters max)"<<endl;
cout<<"\n";
cin>>key;
iv="àc?­Õ=Xò?y"; //default block

cout<<"Do you want to encrypt 1 \nor to decrypt 0 \n?";
int choice;
cin>>choice;
if (choice)
{
//Setup the Blowfish Cipher in CBC-Mode
Blowfish::Encryption blowEn((unsigned char*)key.c_str(),
key.size());
CBC_Mode_ExternalCipher::Encryption cbcEn( blowEn, (unsigned
char*)iv.c_str() );

//Put the "plain" string into the cipher and encrypt it to
"encrypted
StreamTransformationFilter stfEncryptor(cbcEn, new StringSink(
outfilename ) );
stfEncryptor.Put( (unsigned char*)infilename.c_str(),
infilename.size() + 1 );
stfEncryptor.MessageEnd();

}
else
{
// Decrypt (very analog to the encryption block
Blowfish::Decryption blowDe((unsigned char*)key.c_str(),
key.size());
CBC_Mode_ExternalCipher::Decryption cbcDe( blowDe, (unsigned
char*)iv.c_str() );

StreamTransformationFilter stfDecryptor(cbcDe, new StringSink(
outfilename ) );
stfDecryptor.Put((unsigned char*)infilename.c_str(),
infilename.size() );
stfDecryptor.MessageEnd();
}
cout<<"renaming to..."<<outfilename<<endl;
rename(infilename.c_str(),outfilename.c_str());

.