Find/Replace with char arrays without string functions

D

Dmitridj

Heya everyone,

I'm trying to write a program that finds and replace an array of
characters defined by the user in a text file. Basicly the program
finds and replaces a substring typed in by the user. I've got the
opening file and displaying its contents down, but the problem is, I
can not use any of the string member functions to find and replace. I
am trying to read a line of text from the input file at a time and
comparing it to what the user typed in. All I got so far is the
following code segment that only finds a character:

ifstream inFile;
const int i = 11;
char find;
const int j = 81;
char input[j];
char ch;
int count = 0;

inFile.getline(input,j);
inFile.get(ch);
while(!inFile.eof())
{

while(ch != '\n')
{
if(find[i-11] == ch)
count++;


inFile.get(ch);

}
inFile.getline(input,j);
}

Any help would be greatly appreciated!!

Thank you
Dmitridj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top