Help with I/O Stream

EDIT: I've got it to read all the text in the file, now I'm trying to replace specific characters with a new character and have it print each line. How can I check each character and replace it with something specific ?


1
2
3
4
5
6
7
8
9
10
iin_stream.open("blankCrossNumber.txt");
char output[100];

while(!in_stream.eof())
{
	in_stream>>output;
	cout<<output;
}

Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
in_stream.open("blankCrossNumber.txt");
char output; //instead of reading a whole bunch of char's at one time
	// read them one at a time at check to see if you should replace it

while(!in_stream.eof())
{
	in_stream>>output;
	//check if you should replace this char with another
	switch(output) {
	case ...: //if one char
		cout << ...; //print another
		break;
	...
	default: //if not a special char
		cout << output; //reprint it as it was
	}
}
Topic archived. No new replies allowed.