How to search files content with c++

I am new at C++ and i have no idea how could I search for any content at any component or text file. Could any of you plz post some examples or links to them? Thanks in forward...
1. Open a file (use fopen() function)
2. Load it to a memory buffer (fread() function)
3. Search in the buffer.

http://www.cplusplus.com/reference/clibrary/cstdio/
+1 to Chewbob, Null's way is C

Here is a tutorial on how to do basic things with files in C++: http://www.cplusplus.com/doc/tutorial/files/
An example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;

int main( int argc, char** argv )
  {
  if (argc != 3)
    {
    cout << "usage:\n  "
         << argv[ 0 ] << " TEXT FILE\n\n"

            "Search for TEXT in FILE.\n"
            "Reports the line and column number of each occurrence.\n\n";
    return 1;
    }

  const char* text2match = argv[ 1 ];
  const char* filename   = argv[ 2 ];

  ifstream f( filename );
  if (!f)
    {
    cerr << "Could not open file " << filename << endl;
    return 1;
    }

  // Read the entire file into memory
  string s;
  string t;
  while (getline( f, t ))
    s += t + '\n';
  f.close();

  // For each match, print line number and column number
  for (string::size_type index = s.find( text2match, 0 );
       index != string::npos;
       index = s.find( text2match, index + 1 ))
    {
    string::size_type line   = count( s.begin(), s.begin() + index, '\n' ) + 1;
    string::size_type column = index - s.rfind( '\n', index );

    cout << setw( 10 ) << right
         << line
         << " : "
         << left
         << column
         << endl;
    }

  return 0;
  }

Enjoy.
Thanks for all replies guys
Topic archived. No new replies allowed.