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;

	while(!fileEncrypt.eof())
	{
		buffer[i] = ch;
		i++;
		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?

Thanks

Fixed it. It should be static_cast<int>(buffer[j] + 1)
right? Well thats what works

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.