home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / tot5.zip / DEMLS4.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-11  |  1KB  |  60 lines

  1. program DemoList4;
  2. {demls4 - reading a list from a text file}
  3.  
  4. Uses DOS, CRT,
  5.      totFAST, totLINK, totLIST;
  6.  
  7. Var
  8.    ListWin:  ListLinkObj;
  9.    ItemList: StrDLLOBJ;
  10.    FileOK: boolean;
  11.  
  12. procedure LoadLinkedList;
  13. {}
  14. var 
  15.   F: text;
  16.   Line:string;
  17.   Result: integer;
  18. begin
  19.    with ItemList do
  20.    begin
  21.       Init;
  22.       {$I-}
  23.       Assign(F,'demls4.txt');
  24.       Reset(F);
  25.       {$I+}
  26.       FileOK := (IOResult = 0);
  27.       if not FileOK then
  28.          Result := Add('File not found')
  29.       else
  30.       begin
  31.          while not eof(F) do
  32.          begin
  33.             Readln(F,Line);
  34.             Result := Add(Line);
  35.          end;
  36.          close(F);
  37.       end;
  38.    end;
  39. end; {LoadLinkedList}
  40.  
  41. begin
  42.    Screen.Clear(white,'░'); {paint the screen}
  43.    LoadLinkedList;
  44.    with ListWin do
  45.    begin
  46.       Init;
  47.       AssignList(ItemList);
  48.       SetColWidth(15);
  49.       Win^.SetTitle(' Items from file DEMLS4.TXT ');
  50.       Win^.SetSize(20,5,60,20,1);
  51.       if not FileOk then
  52.          SetTagging(false);
  53.       Go;
  54.       Done;
  55.    end;
  56.    ItemList.Done;
  57. end.
  58.  
  59.  
  60.