Quote Originally Posted by katy_price View Post
do you mean i have to put my filenames in here

Code:
 // Open files:

  FileStream ^fInput;
  try {
    fInput = gcnew FileStream("john.txt", FileMode::Open, FileAccess::Read);
  }
  catch (...) {
    return false;
  }
  FileStream ^fOutput = gcnew FileStream("can.txt", FileMode::Create, FileAccess::Write);
No. It's easiest to consider the Crypt() function a black-box and leave it unchanged. Instead, you should pass the file names as parameters when you call it:

Code:
  if (!Crypt("john.txt", "can.txt", "WhateverPassword", bCryptMode)) {
    // Run away and cry...
    return 1;
  }
Of course you wouldn't hard-code neither the file names nor the password in your actual code but I hope you get the idea.

like i've put john.txt, am i required to have the full path?
That depends on whether the file is located in the current working directory (CWD) of your app or not. If you're not sure it's alway better to use the fully qualified path; that would never do any harm if it's actually not needed.

anyway this is still weird for me how do i serparate the dercyption code from the encryption as they are supposed to be in separate programs.
In the scenario we have here it's not really sensible to separate the encryption and decryption code. The two are so similar that they're best left together in a common function. Whether you actually want to encrypt or decrypt is determined by the bMode parameter you pass to Crypt().