Is it:
.p
.pl
.pas
.pascal
Or something else?
And will the various Pascal compilers (notably fpc) bork if you don't use the preferred extension?
What is a PAS file? A . pas file is actually a Source code file which can be found in a Delphi programming project. The Delphi is a software development application used by developers for building Windows based softwares; written in the Delphi language. The Delphi language is a variant of the Object Pascal language.
Developed in the late 1960s, Pascal is an imperative and procedural programming language that was originally designed for teaching programming languages. Today, it's been mostly replaced by C, C++ and Java, but it's still used as an introduction to programming.
So, to read out all text file is just like this : uses crt; var F : text; s : string; begin clrscr; write('Input file name to read : '); readln(s); assign(F,s); { associate it } reset(F); { open it } while not EOF(F) do { read it until it's done } begin readln(F,s); writeln(s); end; close(F); { close it } end.
The most common file extension for Pascal is pas
. As for FPC, it uses the pp
extension to denote FPC-specific code.
I think there is not a "preferred" extension, but you can't miss by using pas
.
.pl
is a bad idea, because it will conflict with both perl and prolog programs.
According to the Wikipedia .pp
, .pas
, .inc
are valid (last one for include files).
You may also check FreePascal Wiki, which describe .pas
as
Unit with Pascal code (typically for a form stored in a corresponding *.lfm file)
and .pp
as
Pascal code
I believe you should use one of these two depending of your own preferences.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With