Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

searching a file for a text

Status
Not open for further replies.

DaZZleD

Programmer
Oct 21, 2003
886
US
Hi.

I'm trying to read the contents of a file (which could have around 2-3Mbs - it's in binary format) and search for a pattern. I have to use Regular expressions so I got a free component that can search a string using regular expressions. How do I get the contents of the file into an WideString or ... if anyone has a better idea...

Thanks
 
I often load text files into a TRichEdit component, and use its FindText method to locate text. However, I'm not sure whether it would be able to handle a text file as big as yours!

Hope this helps!

Clive [infinity]
 
i managed to use a TMemoryStream to read the file and replace all #0 characters (this allows me to use all the output as one string). Then using regular expressions I managed to do this in under 0.3 seconds :D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top