Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > Re: Help with t...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 210 of 211
Post > Topic >>

Re: Help with text file reading

by Maurice Lombardi <Maurice.Lombardi@[EMAIL PROTECTED] > Apr 9, 2008 at 05:54 PM

andrewq2 a écrit :
> Cant get dev-pascal to read from a text file contaning a key(key.txt)

some suggestions below

> code:

> uses crt;
> label
>      start;
> label
>      stop;
> var
> y        : byte;
              ^ 15712774 is too large for a byte, and even
              for a 16 bit integer;
              use integer (gpc or delphi: 32 bits) or longint (BP)
> x        : byte;
> F1       : text;
> FN1      : string;
> begin
> FN1 := 'key.txt';
> 
> assign( F1, FN1 );
> reset( F1 );
> 
> while not EOLN( F1 ) do
> begin
> readln( F1 );
         ( F1, FN1) ???
> val(fn1,y);
> if y=15712774 then goto start
> else;
       ^ do you really want a ; there.
         The following begin end block is _not_ the else clause.
         Anyway it makes no change in this case !!!
> begin
> writeln('Invalid Licence #',y,'');
> writeln('now exting');
> goto stop;
> end;
> 
> close( F1 );
> start:
> repeat
> {code}
> until x=47;
> stop:
> end;
   ^ position of this end implies that you can have in F1
     several lines with different Licence # and treat all
     with a warning if the leadings are not 15712774.
     Is that you want ?
> end.


-- 
        Maurice Lombardi
Laboratoire de  Spectrometrie Physique,
Universite Joseph Fourier de Grenoble, BP87
38402 Saint Martin d'Heres Cedex     FRANCE
Tel: 33 (0)4 76 51 47 51
Fax: 33 (0)4 76 63 54 95
mailto:Maurice.Lombardi@[EMAIL PROTECTED]





 2 Posts in Topic:
Help with text file reading
andrewq2 <andrewquerol  2008-04-09 05:30:56 
Re: Help with text file reading
Maurice Lombardi <Maur  2008-04-09 17:54:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 8:38:01 CDT 2008.