Click to See Complete Forum and Search --> : File Search


Argonic
May 27th, 1999, 08:07 AM
I'm a AP student at a high school loking for some help with a problem i'm having....

I was wonder how i would go about searching for text in a .txt file for .dat file without reading it into an array...

Thank You

-Argonic


Scott Miller

Franky Braem
May 27th, 1999, 08:32 AM
This is one possible solution :

Read a char from the file. If the char is equal to the first char of the searchstring then add one to a counter. Read the next char and check it with the second(= counter) char of your searchstring. If the char is not equal reset counter to 0. If counter is equal to the length of your searchstring then you have found the string in the file.