I want a program that searches for specific infromation on a col through a whole file, by each col. I thought like this but I'm pretty sure of that there's some better code for it:
int main()
{
char text[20];
cin.getline(text, 20, '\n');
std::ofstream tfile("test.dat") /* I don't know how to make it search through the actual file */
while (strcmp(text, "here is the col I search for"))
{
std::cout << "*going to the next col*";
}
When it hits the actual col, the while loop will stop. Then I also would like to put the actual col in a variable.
Please help me so that it can search through the file and also
the "going to next col" code, and finally putting the information on the matching col in a variable. Rewrite the whole code if it's
so inefficient that you find it neccesary.