This belongs in both C and C++ forums, but it's more of C++ (I think) so I'll keep it in here for now.
I'm working on a C++ program to extract files that I am constantly compressing and testing (releasing software for beta testers to take a look at). I use the 7-Zip program to aid in this process.
Here is my code so far, and I bet you can just look at it and guess what's going wrong.
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char file[256];
char opening[14] = "7z.x64.exe x ";
char final[256], tar[6] = "*.tar";
cout<<"Please enter the archive name to extract the files from (please include the extension): ";
cin.getline(file, 256);
strcpy(final, opening);
strcat(final, file);
cout<<"\n"<<final<<"\n\n";
system(final);
cout<<"\n\n";
system("pause");
if (file == "*.tar")
{
strcpy(final, opening);
strcat(final, tar);
system(final);
cout<<"\n\n";
system("pause");
}
}
Well now, I can't get this "if" statement to work, any suggestions? Thanks.
P.S. The parts before the if statement do work.