I am using cpp with some fortran source code that is compiled with a maximum line lenth of 72 characters. __FILE__ works well, but occasionally expands to a long string such that the output of cpp has lines longer than 72 characters. Is there some pre-processor magic I can use to truncate __FILE__? (Either to a fixed size or to get a basename.)
Why not compile allowing your Fortran source code to be longer then 72 characters? Most compilers have an option for this, e.g., -ffixed-line-length-none for gfortran. It shouldn't be a problem unless columns past 72 are being used for comments. Originally columns 73 to 80 were used for line numbers to sort punched cards -- obsolete!! If you have to, revise the current code using a program to strip off characters past column 73.
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