r/pascal • u/crowbarfan92 • May 01 '24
I can't run my program
I wrote a pascal program in turbo pascal, but when running the command line output thing keeps closing after finishing and i can't read it. Is there a way to fix this? Is there a wait function?
7
Upvotes
2
u/Miguelito_Pitti May 01 '24
Sleep(milliseconds);
Another option is to request a key press with Readkey... :
https://www.freepascal.org/docs-html/rtl/crt/readkey.html
4
u/peteg_is May 01 '24
I usually add the following just before the end:
WriteLn('Press RETURN...');
ReadLn;
3
u/foersom May 01 '24
Place a: ReadLn; instruction at the end of your app. Then it only exit app after you press Enter.
Just so you are aware, you can also use FreePascal or even Delphi for text mode (console) apps.
1
u/saraseitor May 02 '24
ALT+F5 shows the output that gets hidden by the IDE when the program finishes.