Re: question on character-like variable defination
- From: nospam@xxxxxxxxxxxxx (Richard E Maine)
- Date: Fri, 31 Mar 2006 08:43:55 -0800
<meek@xxxxxxxxxxxxxxx> wrote:
In a previous article, "sunnylele" <sjsongjing@xxxxxxxxx> wrote:
in Fortran77, normally a variable to store a string can be defined as:
character file
Other have given the answer to your question, but I haven't noticed
anyone explicitly correcting the above misstatement. The correction is
implicit in the answers, but I'll make it explicit.
No, the above is not a way to declare a variable to store a string,
unless your definition of "string" is restricted to strings of length
exactly 1. The above is equivalent to
character*1 file
or
character file*1
whichever format you prefer. (To others: Yes, I know that the
character*1 form is obsolescent in f95/f2003, but that happens to be the
only obsolescent feature that I personally continue to use anyway.)
what does it mean by "character*30" and "character flags*5"It's the new way - flags*5 means flags is character*5
I think you missed half of the question. The OP asked about both of
those forms - not just one of them. So explaining that one of the forms
that he doesn't understand is just like the other form that he doesn't
understand isn't likely to help him much.
But other folk gave the answer (that the numbers declare the length). I
suspect that the OP also doesn't appreciate that all f77 strings have
fixed length (except for assumed-length dummies), along with all the
implications of that. His incorrect presumption that "character file" is
how to declare a string suggests to me that he is thinking of
arbitrary-length strings. But that's getting off into questions not
asked, even if I suspect that they might be questions likely to come up
later.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.
- References:
- question on character-like variable defination
- From: sunnylele
- RE: question on character-like variable defination
- From: meek
- question on character-like variable defination
- Prev by Date: Re: O/T: Patenting a computational scheme?
- Next by Date: Re: fortran code for 'cp' / subroutine file_copy
- Previous by thread: RE: question on character-like variable defination
- Next by thread: fortran code for 'cp' / subroutine file_copy
- Index(es):
Relevant Pages
|