tbs0268.pp 850 B

123456789101112131415161718192021222324252627282930
  1. PROGRAM Test2;
  2. {$MODE DELPHI}
  3. USES SysUtils; // Dos for DosError because FindFirst is not a Function?
  4. PROCEDURE DirList;
  5. (* Show all Files, gives me "unhandled exception occurred at xxx, access
  6. violation" after inserting Try Except it worked but i got a "forever
  7. scrolling screen", then i inserted raise and got a correct "Exception
  8. in FindFirst" and "At end of ExceptionAddressStack"
  9. Next i inserted the ON E:EXCEPTION and ,E.Message an got 9999 *)
  10. VAR SR : TSearchRec;
  11. BEGIN
  12. TRY
  13. FindFirst ('*',faAnyFile,SR); // why not a function ?
  14. EXCEPT
  15. ON E:EXCEPTION DO
  16. WriteLn ('Exception in FindFirst !-', E.Message);
  17. END;
  18. repeat
  19. Write (SR.Name,' ');
  20. until FindNext (SR)<>0;
  21. FindClose (SR); // and this is Delphi ?
  22. END;
  23. BEGIN
  24. WriteLn ('Hello, this is my first FPC-Program');
  25. DirList;
  26. END.