Help need a quick answer to a pascal problem...
Counter : Integer;
ReadFile : TextFile;
FilStr : FilText; //array of Char
FileName : FString; //array of Char
FileText : FilByte; //array of Byte
CompareStr : StrCom; //array of Char
Counter := 0;
WriteLn('Please enter name of file you want to compare');
FileName := CreateName(FileName); //function using array to imput filename
Write('Enter string you will like to find - ');
CompareStr := Compare(CompareStr); //function get input from keyboard
While not EOF(ReadFile) do begin
Counter := Counter + 1;
If FileText[Counter] <> 32 then Read(ReadFile, FilStr[Counter]);
If FilStr = CompareStr then begin
Write('The word ');
Write('is located in line');
The above code is a piece of code from a program that takes a textfile and compares a string that the user inputs and compares it to the file and when it finds that string it is supposed to print out what line it has occured on and how many times it occurred. My problem is that using only standard pascal, how do I take the users string and compare it to the strings in the file.
I think my problem lies with in my while loop.....