CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Searching text in file

    Sir,
    I am using Visual C++ 6.0. I need to determine number of occurances of a text say "showpage" in a file. I am using fget(c) to determine this. The problem is if the file size becomes large it takes large time to scan the file. Is there any other way that is more eficient. Is there any function available for this.
    sajjad


  2. #2
    Guest

    Re: Searching text in file

    fgetc is pretty slow since it reads one character at a time. You should try buffering it, read it into a large buffer, say 4096 in size. THen search that entire buffer for it, then read another buffer etc until the file is ended.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured