Question about arrays

Basically I have to write a decryption program that reads in text from a .txt file, decrypts it, and outputs it to a new .txt file. I am having trouble getting it started.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cctype>
using namespace std;

void key(char cypher_par[]);

int main()
{ 

	char cypher[26];

	key(cypher);

	return 0;

}

void key(char cypher_par[])
{
		
	char letter;

	ifstream infile_cypher;

	infile_cypher.open("substitution.txt");
	
	for(int x = 0;x < 26; x++) {
		cypher_par[x] =infile_cypher.get(letter);
	}
}


That is currently what my code looks like, and I am getting an error when trying to compile it. The code isn't complete but I am trying to take it one step at a time. When compiling, I get
1
2
decrypt.cpp: In function ‘void key(char*)’:
decrypt.cpp:41:42: error: invalid conversion from ‘void*’ to ‘char


I figure this is a problem with my array, so can anyone tell me what that error means? I have searched and found similar problems, but I don't really understand how they are fixed, as they are coded differently than I am being taught.

Any help would be great.

Thanks,
Chris
Last edited on
infile_cypher.get(letter); returns infile_cypher, not a char value.

http://www.cplusplus.com/reference/iostream/istream/get/
Topic archived. No new replies allowed.