hello,
i am a little confused with something. im reading values from a text file which only contains 1's and 0's. here is the code.
char y;
ifstream inFile2;
inFile2.open("c:\\binary.txt");
ofstream fileout2;
while (inFile2 >> y)
{
//cout<<y<<" "; this would print either a 1 or 0 // based on file.
if (y=1) //here lies the problem
{
fileout2.open("c:\\confidential.lck");
}
else
std::remove("c:\\confidential.lck");
Sleep(1000);
}
inFile2.close();
i want to compare the value of y. if it is a one, it should create the file and if it is a 0, delete a file.
i also tried y==1 and y=="1" but it does not work.
any help will be appreciated.
thanks.