int main() { char *plain_text, *encrypted_text, *decrypted_text; int index, *key, key_length, *key_length_address = &key_length; long length; long *length_address = &length; if(FilterText() == -1) { printf("\nA file I/O has occured!"); exit(1); } if((plain_text = ReadPlainText(length_address)) == NULL) { printf("A problem has occured!"); exit(2); } if((key = GenerateKey(key_length_address)) == NULL) { printf("A memory problem has occured!"); exit(3); } if((encrypted_text = Encrypt(key, key_length, plain_text, length)) == NULL) { printf("A memory problem has occured!"); exit(4); } if(WriteTextToFile("encrypted_text.txt" ,encrypted_text, length) == -1) { printf("\nA file I/O has occured!"); exit(5); } if((decrypted_text = Decrypt(key, key_length, encrypted_text, length)) == NULL) { printf("A memory problem has occured!"); exit(4); } if(WriteTextToFile("decrypted_text.txt" ,decrypted_text, length) == -1) { printf("\nA file I/O has occured!"); exit(5); } free(plain_text); free(encrypted_text); free(decrypted_text);; free(key); return 0; }
bool Filters::CheckItem(const Item& item) const { // Filter my status for (size_t i = 0; i < my_status.size(); i++) if (!my_status.at(i) && item.GetMyStatus() == i) return false; // Filter airing status for (size_t i = 0; i < status.size(); i++) if (!status.at(i) && item.GetAiringStatus() == i + 1) return false; // Filter type for (size_t i = 0; i < type.size(); i++) if (!type.at(i) && item.GetType() == i + 1) return false; // Filter text if (!FilterText(item)) return false; // Item passed all filters return true; }