Just a sample of the Echomail archive
Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.
|    PASCAL_LESSONS    |    Pascal Programming Lessons    |    361 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 257 of 361    |
|    Joseph Larsen to All    |
|    FPC Oneliners.    |
|    05 Jun 16 09:30:42    |
   
   Here's some code i'm having problems with. For some reason it takes two   
   presses of the down arrow key to get the bot_bar procedure.   
      
   --//--snip---------   
      
   procedure oneliners;   
      
   var Twriters : array[1..10] of string;   
   var Toneliner : array[1..10] of string;   
   var S : string;   
   var Foneline : string;   
   var Ch1 : char;   
   var Ch2 : char;   
   var Ch3 : char;   
   var Count : byte;   
   var Count2 : byte;   
      
      
   //### begin show procedure ######################################   
      
   Procedure show;   
      
   var Count : byte;   
      
   Begin   
   // clrscr;   
    printf('oneh.ans');   
    For Count := 1 To 10 Do Begin;   
    write('[1;37m+[0;37m');   
    write(Twriters[Count]);   
    write('[1;30m: 0;37m');   
    WriteLn(Toneliner[Count]);   
    End;   
   End; // show   
      
   //### end show procedure ########################################   
   //### begin init procedure ######################################   
      
   Procedure init;   
      
   Var f1 : textfile;   
   var Count : byte;   
      
   Begin   
   // GetThisUser;   
    fOneLine := ('/home/imp/imp/data/oneliner.lst');   
    If Not fileExists(fOneLine) Then Begin   
    Assign(f1, fOneLine);   
    ReWrite(f1);   
    For Count := 1 To 10 Do Begin   
    WriteLn(f1,'Ia! Cthulhu!');   
    WriteLn(f1,'IGNATIUS');   
    End;   
    Close(f1);   
    End;   
      
    Assign(f1, fOneLine);   
    Reset(f1);   
    If IoResult = 0 Then Begin   
    For Count := 1 To 10 Do Begin   
    ReadLn(f1, Toneliner[Count]);   
    ReadLn(f1, Twriters[Count]);   
    End;   
    Close(f1);   
    End;   
   End; // Init   
      
   //### begin bot_bar procedure ###################################   
      
   Procedure bot_bar;   
      
   Begin   
    printf('onen.ans');   
    Ch2 := ReadKey;   
    If Ch2 = #13 then Begin   
    exit;   
    End;   
    show;   
   End; // bot_bar   
      
   //### end bot_bar procedure #####################################   
   //### begin top_bar procedure ###################################   
      
   Procedure top_bar;   
      
   Var f1 : textfile;   
   var Count : byte;   
   var ch3 : char;   
      
      
   Begin   
    printf('oney.ans');   
    Ch3 := ReadKey;   
    If Ch3 = #13 then Begin   
    printf('oneline.asc');   
    Write('[3;3H');   
    inputl(s,70);   
    If s = '' then Begin   
    WriteLn('[1;30maborted[0;37m');   
    show;   
    Exit;   
    End;   
      
    For Count := 1 To 9 Do Begin   
    Count2 := Count + 1;   
    Toneliner[Count] := Toneliner[Count2];   
    Twriters[Count] := Twriters[Count2];   
    End;   
      
    tWriters[10]:=thisuser.name;   
    tOneliner[10] := s;   
      
    Assign(f1, fOneLine);   
    ReWrite(f1);   
    For Count := 1 To 10 do Begin   
    WriteLn(f1,tOneliner[Count]);   
    WriteLn(f1,tWriters[Count]);   
    End;   
    Close(f1);   
    End;   
    show;   
   End; // top_bar   
      
   //### end top_bar procedure #####################################   
   //### begin position procedure ##################################   
      
   Procedure position;   
      
   Begin   
    show;   
      
    Repeat   
    ch1:=ReadKey;   
    case ch1 of   
    #0 : begin   
    ch1:=ReadKey;   
    case ch1 of   
    #80 : bot_bar;   
    #72 : top_bar;   
    end;   
    end;   
    end;   
    until ch1=#13   
   end;   
      
   //### end position procedure ####################################   
      
   Begin   
    init;   
    Position;   
   End;   
   --//--snip----------   
      
   If someone could give me an idea of what's wrong, i'd appreciate it.   
      
   Thank you,   
      
      
   |09ignatius |07(|15cia|07)   
      
   --- DayDream BBS/UNIX (Linux) 2.15a   
    * Origin: catch22bbs.com >>> >> > (1:340/800)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca