Hey,
I have a file that I am working with that I have pass into my program through command line arguments. I don't want to touch the file, just want to store a temp of the file then after fixing the temp place it back in the original. After running the program it works but I keep getting an error message about my variable "filename". I know it has something to do with the way I assigned filename and argv[1]. I was looking into other ways of copying it, such as deep coping but I am not really dealing with pointers. I don't know if I need a for loop. I'm just moving the content of argv[1] ( the argument to a temp space then placing it back. real simple I know but idk where I'm stuck. Thank you in advance
int main(int argc, char *argv[])
{
bool Stats;
char filename[100];
ifstream in1;
do
{
in1.open(argv[1], ios::binary);
if (!in1)
cout << "That is not a valid file. Try again!\n";
} while (!in1);
strcpy (filename, argv[1]);
strcat (filename, ".txt");
ofstream out1 (filename, ios::binary);
Stats = FixFile(out1, in1);
strcpy (argv[1], filename);