I need to have a C++ program that can:
1) open and read the content of the file - newevent.txt
2) check for "Open" and save the data record name e.g. line 2 data record name is "MAT 33 HSR3" ("Open" always from position 73 to 76, data record name always from position 36 to 46).
3) check in the 3 records above and below the data record with "Open" for "Operated". If found, compare the data record name with the data record name with "Open". If data record name matches each other, save the name in the file - filteredevent.txt ("Operated" always at position 73 to 80). Of course, at the begin and end of file, 3 records each above and below can be less or 0.

Open a std::ifstream. Read lines into std::string, using getline. Keep a std::vector<string> of 7 lines read (use a round robin - to maintain them e.g. [lines_read % 7].

Ignore the start and end of this process for the moment. Conceptually it is easiest to go back to them, when you've got the middle bit right.

Look at the relevant part of the 4th string index [(lines_read-3) % 7] in the vector, using std::basic_string<>::substr to find an "Open". If you've got an "Open" look at the 1st 3 and the last 3 for "Operated".

Then read another string into the vector at position [lines_read % 7].

You'll need to handle the start and end, once you've got the middle bit working.

If you want me to write the application for you, you'll find that I suddenly go mercenary on you and would want to charge a fee to keep me in Chapagne and caviar. It's how I earn my living.

You may find that there is a more altruistic expert hereabouts, who is willing to do this gratis, but the best way to go about this through EE is to have a go yourself and use the collaborative process to find your way through the assignment.

If your boss has assigned you this, you've been set a project which will put you off C++ for life. It is much too tough for day 2!! I've been writing C++ for 12 years and I don't find this kind of thing easy.

It looks like a commercial application, so I'll give you some code. Here's a full working program, which I'd normally charge an arm and a leg for, being a commercially motivated kinda fellow.

If you want to learn C++, I recommend working from tutorials or primers. If you need work like this done for commercial purposes, I recommend employing the services of someone who has had time to work through tutorials and primers.

// Check string at the specified working index in the round_robin
void check(int working_index,ostream& os)
{
// Work with the 4th string in the round robin
const string& working_line = round_robin[working_index];

This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++.
The reason I built this class is to ease the pain of using XML files with C++, since there is…

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects.
A brief on problem:
Lets take example problem for simplicity:
- I have a G…

The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…