Searching ........for help
Hi
I have a question on how i go about searching through a text file.
actually i know there are a lot of functions that can be used but i dont know how to go about it.
first off do i open a file and read it all into an array !
This doesnt seem good as how do i know the size of the array that must be created as the file will get bigger all the time.
What i do know is that each line in the file will not exceed 100 characters.
But there can be as many lines as need be.
I need some direction here, cause if i dont read the file into an array , how do i go about searching through the array or whatever??
also I do know that i will only have to compare the first 30 characters of each line with an input string that the uset types in.
Basically what i want to do is this:
Enter name: John
then the program goes and opens the text file (Here i get confused )
it searches through the first 30 characters of each line and compares it to the users input.
When it finds a match it outputs all 100 characters of that line.
If anyone can give me direction here , thanx
Also to keep it simple would be cool :cool: as im still learning this stuff.
thanx
:D