I am a beginner at programming with fortran and g95.
I need to compile and run a fortran77 source file with g95, but I
cannot modify this source file (which was made by a f90 user, so it
compiles good with it).
But when I type:
g95 myfile.f
I get the following error message:
parameter (idtype = 4, inopo = 29, intacm = 32, nopo =
'NOPO')
1
Error: Can't convert CHARACTER(1) to INTEGER(4) at (1)
In the code the line just before this flagged line is:
integer idtype, inopo, intacm, nopo
Also it seems that there is a type conversion problem.
Is there an option in g95 that allows it to make implicit type
conversion between character and integer.
Don
thank you for answering my message.
Actually, NOPO is declared as an integer!
Here:
integer idtype, inopo, intacm, nopo
parameter (idtype = 4, inopo = 29, intacm = 32, nopo = 'NOP0')
so nopo is declared as an integer and then attributed a string, this
is what I don't understand.
When I put a "print*, nopo" after those lines I get the value
810569550.
Isn't this weird?
> > conversion between character and integer.- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -
Try changing the two lines you posted to something like:
INTEGER :: idtype, inopo, intacm
CHARACTER(LEN=4) :: nopo
PARAMETER (idtype = 4, inopo = 29, intacm = 32)
nopo='NOP0'
Doug
If you really can't change the source code to avoid this non-standard
(but in the past quite popular) trick, then I don't know what you can
do.
Steve.
Thank you very much for your answers.
Actually, as Robert says, this was apparently a popular trick in the
past...but it is really non standard! Also I obtained the permission
to modify the code.
I tried to use the advice of Steven...the fortran TRANSFER
function.....and it works!
This function is great.
I put
nopo = TRANSFER('NOP0',nopo)
and it is allright.
Thank you all!
LouisJ