Hi,
I am a beginner C++ programing student, and I am stuck with this question that I hope some body can help me with. I am trying to write a program that would read from one file and transfer it to the new file, at the same time editing it also. Editing the file by taking all of the extra white space out, of the old file, and replace it with a single white space. I can get the file to transfer to the new file, but I cannot get it to edite the file. Here is the definition that I got:
void EditFile(ifstream& InStream, ofstream& OutStream)
{
char next;
InStream.get(next);
while ( ! InStream.eof())
{
if (next == ' ')
{
Outstream << " ";
}
else
{
Outstream << next++;
}
InStream.get(next);
}
}
This is part of the codes that I got, I would really appreciated if any one could help me. Thank you very much.



LinkBack URL
About LinkBacks


