Hello, i have function to encrypt & decrypt string with XOR, but i have problem, when i encrypt some string, then sometimes encrypted string have newline in a string and when i write it into file, then my string is on two lines and i cant read it with reader->ReadLine(), because i get only part of a string. How can i write with StreamWriter write->WriteLine on one line with newline chars etc? Thanks
Function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
static String ^ XOR_S(String ^ value, String ^ key)
{
std::string retval(marshal_as<string>(value));
shortunsignedint klen = key->Length;
shortunsignedint vlen = value->Length;
shortunsignedint k = 0;
shortunsignedint v = 0;
for (v; v < vlen; v++)
{
retval[v] = value[v] ^ key[k];
k = (++k < klen ? k : 0);
}
return marshal_as<String^>(retval);
}
i think i mus use writer->Write and then make while(text = reader->ReadLine()) and put into file split char for example when file readsline, then make decryptedstring+=decryptedstring and when program find split char for example <<>> then decryptedstring = "" and again for next encrypted string lines