I'm having problem with a program im trying to write that reads a .text sourcefile and then format the .text file while removing excess whitespace.
#include <fstream>
using std::ofstream;
using std::ifstream;
#include <iostream>
using std::cin;
using std::cout;
using std::cerr;
#include <sstream>
#include <iomanip>
#include <cstring>
using std::string;
using namespace std;
#include <cstdlib>
using std::exit;
#include <stdio.h>
int main (void)
{
const int MAX = 100;
char buff[MAX];
string name;
int i;
int countWords(const char string[]);
void readLine(char buffer[]);
cout << "Enter name of input text file(location on disk): "<<endl;
getline (cin, name); //Prompts user to input source text
if (!input) {
cerr << "Unable to open file hw6.txt";
exit(1); } // call system to stop
else{
while (!input.eof()) //until end of file
{
input.getline(buff, MAX); //read line of text
I did that already, What i'm trying to do is remove the excess white space from the source text file and save it to another file with ofstream. Every word should be separated by one space " " and each line should be 100 characters long.