Current location - Loan Platform Complete Network - Big data management - Fortran to C Conversion Programs
Fortran to C Conversion Programs
f2c and p2c are two source code conversion programs. f2c converts FORTRAN code to C code, and p2c converts Pascal code to C code. Both programs are installed when you install GCC.

f2c and p2c are useful if you have some code written in FORTRAN or Pascal that you want to rewrite in C. The C code produced by these two programs can usually be compiled directly by GCC without modification.

If you are converting a small FORTRAN or Pascal program, you can use f2c or p2c without any options. If the program you want to convert is large and contains a lot of files you may need to use some command line options.

To use f2c on a FORTRAN program, enter the following command:

f2c my_fortranprog.f

Note: f2c requires that the program to be converted has an extension of .f or a .F .

To convert a Pascal program into a C program, enter the following command:

p2c my_pascalprogram.pas

The C source code produced by both programs has the same filename as the original, but with a .c extension instead of .f or .pas.

The file name is the same as the original, but with a .c extension.