The directory I wish to check is just the standard project folder from Microsoft Visual C++ where the files are written/read from by default
Below is what I have already, it prompts a user to enter a file name. Ultimately I want to be able to send this file over sockets but at the moment I am just looking to check the directory for that filename and then add it's extension on for sending.
printf("Please enter the name of the file you wish to send.\n\n");
string inputFile;
std::cin >> inputFile;
/*ofstream myfile;
myfile.open("example.txt");
myfile << "Writing this to a file.\n";
ifstream myfile ("example.txt");
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
cout << line << '\n';
}
myfile.close();
}
myfile.close();
*/
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
/*ifstream my_file(inputFile+".*");
if (my_file.good())
{
printf("Success");
}*/
}
/*
if (inputFile == "example")
{
inputFile = example.txt;
AESFileEncrypt(inputFile.c_str(), HKab);
AESFileDecrypt(HKab);
string STRING;
ifstream infile;
infile.open("example_aes.txt");
int a=0;
string previousLine="";
while(a<1) // To get you all the lines.
{
getline(infile,STRING); // Saves the line in STRING.
if (STRING != previousLine)
{
previousLine=STRING;
cout<<STRING<<endl; // Prints our STRING.
}
infile.close();
system ("pause");
}
//connectedSocket->SendFile("AES"+inputFile);
}
else if (inputFile == "liverpool")
{
inputFile = liverpool.jpg;
AESFileEncrypt(inputFile.c_str(), HKab);
AESFileDecrypt(HKab);
}
}
else
{
printf("You have not selected a valid option.\n\n");
}
*/
}