Hi, I'm making a small program that sends data to a program that is constantly moving around. (to practice my c++)and it needs to be able to read file paths (C:\\Dev-Cpp\\...etc) from a file and store it in a char array (this is all I could figure out worked for storing file paths without an error) So far I have all the code down except the part where I send it to the function request(). I store the path name in a char array, and it generates an error "Invalid conversion from char* to char"
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <windows.h>
using namespace std;
int request(char);
int main()//Run.test() is the class to test the file.
{
int check;//this used to store 1 if request worked, 0 if it didn't
char FilePath[] = "C:\\Dev-Cpp\\keylogger.exe";//this is the file path the data is sent to.
check=(request(FilePath));
if (check==1)
{
cout << "It worked, check for yourself!";
}
return 0;
}
int request()
{
int temporary=0;
ofstream Asker("Liason.def",ios::trunc);
if(Asker.is_open())
{
Asker << FilePath;
MoveFile("Liason.def",FilePath);
temporary=1;
}
else
{ temporary=0; }
return temporary;
}
I'm sure this is a very simple problem, but I really can't figure it out (i'm still a c++ noob)
Anyone know what my problem is?