Article View: comp.lang.pascal.borland
Article #646Re: WHAT COULD BE WRONG?
From: Palinkas Tibor
Date: Thu, 18 May 2000 00:00
Date: Thu, 18 May 2000 00:00
53 lines
2596 bytes
2596 bytes
Use halt command instead of exit. Anyway not the nicest solution, but
should work :)
On Thu, 18 May 2000 br-pede@online.no wrote:
>
>
> I am trying to make a software, where the user can put in some word, and the
> program will look and see if the word(s) is in a wordlist file. Everything
> is working pretty well, except this: The procedure is running in a recursive
> way, that if you want to look up more than one word, you only put it in next
> time you are asked. To exit this, you only have to input an empty string,
> that is to press the ENTER key. And here is the trouble. The program will
> not stop this looping, unless you enter several empty words.
>
> Here is the snip of the program that is causing trouble:
>
> procedure lookup;
> begin
> writeln;
> write('please enter word to be looked up: ');
> readln( s ); { s : STRING; }
> if s = '' then exit; { this doesn't work,
> unless running a couple of
> assign(f,'wordlist.dat'); reset(f);
> repeat
> read(f,t); { t : STRING }
> if t = s then found := true else found := false; {found : BOOLEAN}
> until eof(f);
> close(f); {f : FILE OF STRING}
> if not found then begin
> writeln('the word ', s, 'is not found in the list');
> lookup;
> end;{if}
> writeln('the word ', s, ' is found in the list');
> end;{ procedure lookup}
>
> Begin
> { call a menu}
> Repeat read(keychoice) until keychoice in [#0 .. #255];
> { keychoice : CHAR }
> if keychoice = '1' then lookup;
> { call the menu}
> ...
> end.
>
> Hope anybody out there could help. It will be greatly appriciated.
>
> regards,
> Brian
> times}
> Net-Tamer V 1.11 - Test Drive
>
Technical Details
Message-ID:
<Pine.GSO.4.21.0005181106220.28360-100000@ural2>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<D0OU4.6707$C9.118410@news1.online.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1097b9,1d4aea8798c741f5 X-Google-Attributes: gid1097b9,public X-Google-Thread: 111659,1d4aea8798c741f5 X-Google-Attributes: gid111659,public From: Palinkas Tibor <pt131@hszk.bme.hu> Subject: Re: WHAT COULD BE WRONG? Date: 2000/05/18 Message-ID: <Pine.GSO.4.21.0005181106220.28360-100000@ural2> X-Deja-AN: 624903495 References: <D0OU4.6707$C9.118410@news1.online.no> X-Sender: pt131@ural2 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Complaints-To: abuse@news.bme.hu X-Trace: goliat.eik.bme.hu 958640855 4151 152.66.130.2 (18 May 2000 09:07:35 GMT) Organization: Technical University of Budapest Mime-Version: 1.0 NNTP-Posting-Date: 18 May 2000 09:07:35 GMT Newsgroups: comp.lang.pascal.borland,dk.edb.programmering.pascal