void encrypt::transform()
	int length = 0;
	char *buffer;

	char ch = ' ';

	int i = 0;
	fileEncrypt.open("filter.txt", ios::in | ios::beg);
	fileEncrypt.seekg(0, ios::end);
	length = fileEncrypt.tellg();
	fileEncrypt.seekg(0, ios::beg);

	buffer = new char [length];
	fileEncrypt >> ch;

		buffer[i] = ch;
		fileEncrypt >> ch;

	for(int j = 0; j < length; j++)
		buffer[j] = static_cast<int> + 1;


Everything compiles fine, and Ive tested my dynamic array and it is given the proper size etc... but in my static cast for loop, it is giving me a syntax error upon compile. What am I doing wrong?


You need to static_cast<int>(something) you can't just have it by itself. In reality you may not even need it at all, remember that chars are one-byte ints. If anything at all you'd almost need static_cast<char> for that quantity to put it back into buffer.

Edited 6 Years Ago by jonsca: n/a

This question has already been answered. Start a new discussion instead.