tb0229.pp 949 B

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