TIP: Click on subject to list as thread! ANSI
echo: pascal
to: ALL
from: `Mike Copeland`
date: 1999-03-10 00:00:00
subject: set line limit

 NT> How can i limit the line of user entering while standart readln
 NT> procedure runing? For example, i can see at the screen and enter only
 NT> x symbols.  

   I assume this is for password processing, right?  Here's a routine
you can modify:

procedure MyRead (var St : string; Q : Byte);  { internal string }
var C1,C2 : char;
begin
  St := '';                           { initialize string length }
  repeat
    C1 := ReadKey;
    case C1 of
      #27  : begin                                      { escape }
             end;
      #00  : begin
               C2 := ReadKey;                  { fetch scan code }
               case C2 of
                 #59  : ;                                   { F1 }
                 #60  : ;                                   { F2 }
                 #61  : ;                                   { F3 }
                 #62  : ;                                   { F4 }
                 #63  : ;                                   { F5 }
                 #71  : ;                                 { Home }
                 #79  : ;                                  { End }
                 #72  : ;                             { Up Arrow }
                 #80  : ;                           { Down Arrow }
                 #108 : ;                               { Alt-F5 }
                 else   begin                       { all others }
                        end
               end  { case }
             end;
      #13  : ;                                             { C/R }
      #08  : begin                                   { Backspace }
               if Length(St) > 0 then
                 begin
                   Dec (St[0]);                { truncate string }
                   Write (#08#32#08)
                 end;
             end;
      else   begin                            { normal character }
               St := St+C1;    { concatenate character to string }
               Write ('*')                        { mask echoing }
             end
    end;  { case }
  until (C1 = #13) or (Length(St) >= Q)
end;  { MyRead }

.. Objects under T-Shirt are larger than they appear.
/======================================================================
| Orange County Usenet  Fidonet gateway                              
|                                                                      
| User email address:   Mike.Copeland.noemail@webworldinc.com                                             
| FTN email: Mike Copeland[RemoveThis]@f307.n114.z1.fidonet.org
| User FidoNet address: 1:114/307                                             
| Report abuse of this service to joejared@webworldinc.com

SOURCE: alt.fidonet via archive.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.