bug0268.pp 849 B

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