Steganography MFC program problem...
Hi all,
I am trying to understand this piece of code. It is generating few
errors..
Well i have commented the section where i get the exception about i is
not defined. Whereas i is defined. But it keeps on giving me this
error. If i define i of for loop ..still i get the same error. And
also i dont understand what this statement"
message_file.open("message.steg",ios::out|ios::binary);" is doing. I
know its to open the file ..But there is no file by this name
anywhere. So is it created itself to store the message that i type in
or wt....
Any help would be highly appreciated...
thanks
void encrypt_message::message_encryption()
{
int no_of_chars = 8;
//int i;
TCHAR c;
wofstream message_file;
wifstream message_encrypt_file;
message_file.open("message.steg",ios::out|ios::binary);
for(int i = 0; i<_tcslen(message);i++)
message_file.put(message[i]);
message_file.close();
get_key();
sub_key();
message_encrypt_file.open("message.steg", ios::in|ios::binary);
message_file.open("encrypted.steg", ios::out|ios::binary);
while(message_encrypt_file)
{
for(i=0; i<8; i++)
{
if(!message_encrypt_file)
{
message[i]='\0';
break;
}
else
{
message_encrypt_file.get(c);
message[i]=c;
}
}
message[i]='\0'; // EXCEPTION HERE THAT i is used without
defining.
convert_to_bits(message, message_in_bits);
sub_message();
_tcscpy_s(message_in_bits,encrypted_in_bits);
convert_from_bits();
for( i=0;i<no_of_chars;i++)
message_file.put(message[i]);
}
message_file.close();
message_encrypt_file.close();
message_encrypt_file.open("encrypted_message.steg", ios::in|
ios::binary);
i=0;
while(message_encrypt_file)
message_encrypt_file.open("encrypted_message.steg",ios::in|
ios::binary);
i = 0;
while(message_encrypt_file)
message_encrypt_file.get(message[i++]);
message[i]='\0';
message_encrypt_file.close();
}