Let's start off with some slightly modified basics. Here's a little different version of your code:
Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main()
{
ifstream inClientFile("data.dat", ios_base::in);
if(!inClientFile.is_open()){
cerr<< "File cannot be opened";
return 1;
}
// do file stuff here
return 0;
}
First you need somewhere to save read data. (ie: char text[100];)
You also need a temporary file.
Then you need to read each line and write it to the temporary file if it doesn't have a capital or if its length is <= 5.
Then you need to close both files and rename the temp file to the original file.
[edit]
To offer a little more, do something like this:
Code:
while (inClientFile.getline(text, 100).good()) {
if (!hasCapital(text) && strlen(text) <= 5)
tempFile << text << endl;
//...
}
// then close both files
// then delete the source file
// then rename the temp file to the source file name
That should get you on your way...