" ------------------------------------------------" i need to read string after "component=" and the strings like (Coincident1, Coincident2, Parallel1), for example in this text the result should come like this.. base-1, cylinder-1, and Coincident1,Coincident2, Parallel1
I hav tried with this program... but it reads whole text ... please help me...
// FileInput - read blocks of data from a file
#include <fstream>
#include <iostream>
using namespace std;
ifstream* openFile(istream& input)
{
for(int i=0;i<10;i++)
{
// open the file specified by the user
char fileName[80];
cout << "Enter the name of a file" << endl;
// read input from the user in such a way
// that the input can’t overflow the buffer
input.getline(fileName, 80);
//open file for reading; don’t create the file
//if it isn’t there
ifstream* pFileStream = new ifstream(fileName);
if (pFileStream->good())
{
return pFileStream;
}
cerr << "Couldn’t find " << fileName << endl;
}
return 0;
}
int main(int nNumberofArgs, char* pszArgs[])
{
// get a file stream
ifstream* pFileStream = openFile(cin);
// read blocks of data 80 bytes at a time
char buffer[80];
while (!pFileStream->eof() && pFileStream->good())
{
// read a block - 80 is the max but gcount() returns
// the actual number of bytes read
pFileStream->read(buffer, 80);
int noBytes = pFileStream->gcount();
// do something with the block
for(int i = 0; i < noBytes; i++)
{
cout << buffer[i];
}
}
system("PAUSE");
return 0;
}