View previous topic :: View next topic |
Author |
Message |
stfark1
Joined: 02 Sep 2008 Posts: 210
|
Posted: Tue Sep 23, 2008 4:16 am Post subject: Statement Structures |
|
|
IN MICROSOFT FORTRAN, THE STATEMENTS: CHARACTER CINPUT2*1(, CINPUT3*8 AND EQUIVALENCE (CINPUT2(1),CINPUT3) WILL CREATE A VARIABLE CINPUT2, WITH DIMENSION 8, EACH ELEMENT BEING 1 CHARACTER LONG AND WILL EQUIVALENCE ARRAY ELEMENT 1 IN CINPUT2 TO THE FIRST CHARACTER IN CINPUT3, THE 2ND ARRAY ELEMENT IN CINPUT2 TO CINPUT3, 2ND CHARACTER AND SO FORTH. IN ORDER TO RE-PRODUCE THIS SEQUENCE IN SILVERFROST FORTRAN, ONE HAS TO KNOW WHAT THE STATEMENT STRUCTURE IS FOR SILVERFROST FORTRAN, THE QUESTION IS, WHERE IS THIS STATEMENT STRUCTURE TO BE FOUND? WHEN I TRY TO COMPILE AS IS, I GET AND ERROR THAT SAYS "IN VARIABLE CINPUT2*1(, '(' WHERE VARIABLE NAME EXPECTED" ??? PLEASE LET ME KNOW WHERE THE STATEMENT STRUCTURE DEFINITION IS. THANKS, SID KRAFT |
|
Back to top |
|
|
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Tue Sep 23, 2008 7:00 am Post subject: |
|
|
Sid,
Please don't post all in capitals, as it makes your post look loud and harsh on the eye. Also use [code] for source code to prevent unwanted smilies appearing.
Regards,
John |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Sep 23, 2008 7:26 am Post subject: |
|
|
FTN95 obeys the rules of standard Fortran 95. It allows some extensions to the standard but if you stick to standard Fortran then you should be OK.
If you want to post the code fragment that causes the error report then someone will probably help you to locate the programming error. |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Tue Sep 23, 2008 8:53 am Post subject: |
|
|
The format of the character statement is a little wrong. Try this:
Code: |
character*1 CINPUT2(8)
character*8 CINPUT3
EQUIVALENCE (CINPUT2(1),CINPUT3)
cinput3 = 'qwertyui'
print *,cinput2
end
|
And if you wish to access a single character of CINPUT3 by using equivalence so that you can refer to a single array element in CINPUT2, why not forget about EQUIVALENCE and access the desired character as:
Instead of
EQUIVALENCE would only really make sense if you wanted to access individual characters as integer*1 numbers. i.e. replace character*1 with integer*1.
Regards
Ian |
|
Back to top |
|
|
|