forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Statement Structures

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
stfark1



Joined: 02 Sep 2008
Posts: 210

PostPosted: Tue Sep 23, 2008 4:16 am    Post subject: Statement Structures Reply with quote

IN MICROSOFT FORTRAN, THE STATEMENTS: CHARACTER CINPUT2*1(Cool, 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(Cool, '(' WHERE VARIABLE NAME EXPECTED" ??? PLEASE LET ME KNOW WHERE THE STATEMENT STRUCTURE DEFINITION IS. THANKS, SID KRAFT
Back to top
View user's profile Send private message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Tue Sep 23, 2008 7:00 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Tue Sep 23, 2008 7:26 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Tue Sep 23, 2008 8:53 am    Post subject: Reply with quote

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:

Code:

  CINPUT3(i:i)


Instead of
Code:

  CINPUT2(i)


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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group