so i been using i/o streams and i understand how to open, check to see if file fails and close files but i cannot understand how to change it to something new i g2 do these,
Change dashes to spaces.
Change all characters to lowercase. Change digits to * (asterisks).
Display these two totals after processing the file:
Count all spaces written to the output file.
Count all alphabetic characters written to the output file.

any hints or tips or any help would be greatly appreciated.

so here the start of my code

#include <iostream>
include <iomanip>
#include <fstream>
#include <cstdlib>
#include <cctype>
using namespace std; 
void editFile(ifstream& infile, ofstream& outfile);
int main()
{
	ifstream infile;
	ofstream outfile;
	cout << "Editing file will now begin.\n";
	//textin file
	infile.open("C:\\textin.dat");//home
	//infile.open("F:\\cins 225\\textin.dat");//away
	if (infile.fail())
	{
		cout << "Input file has failed to open, now exiting.\n";
		system("pause");
		exit(1);
	}
	//textout file
	outfile.open("C:\\textout.dat");//home
	//outfile.open("F:\\cins 225\\textout.dat");//away
	if (outfile.fail())
	{
		cout << "Output file has failed to open, now exiting.\n";
		exit(1);
	}
	//editFile(infile, outfile);
	//char next;
	//infile.get(next);
	//while (next != '.' )
	//{
	//	if (next == '-' );
	//	{
	//		outfile << " ";
	//	}
	//	 if(next = isalpha)
	//	{
	//		 next = tolower(' ');
	//	}
	//}
	infile.close( );
	outfile.close( );
	
	cout << "Editing file will now end.\n";
	system("pause");
	return 0;
}

btw in the file its says
it-is a-CaPital Mistake tO-theorize Before-one has DatA123.
and i have to change that

use getline() to read each line of the file then a loop to iterate through the string

std::string line;
while( getline( infile, line ) )
{
    // make changes not shown
    //
    outfile << line << "\n";
}
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.