Re: Sequences
Jim Roberts wrote:
>
> In EUPHORIA I read a file that was written in FORTRAN and it has the
> following format:
>
> 4I4
>
> A record might look like this where "b" is considered to be a blank.
>
> bbb0bbb0bbb0bbb0
>
> or
>
> bb23b112bb34bb23
>
> or
>
> b103bb58bbb6bb23
>
> I can go thru each record checking for blanks and probably convert the
> numeric values but I have not found an easy way. When I look at each
> record in a sequence statement all four characters are in a group. There
> has got to be a simple way to convert each 4 character field to an
> integer. It is my understanding that a dimension statement does not
> exist in EUPHORIA. Is this true? The reason I ask is that as I unpack
> each 4 characrter numbers in each record I would like to place it in a
> buffer where I can use it as an integer for later calculations.
>
> I guess I can place them back in a sequence to do all of my calculations.
>
> If someone will help me with this simple problem I would be very
> appreciative as I am still trying to convert a simple QB program to a
> EUPHORIA program!
>
> Thanks,
> Jim Roberts
off the top of my head, i'd say you needed an algorithm
that appears akin to:
numberlist = {}
while not EOF do
temp = {}
for i= 1 to 4 do
temp = temp & getc(FN)
end for
temp = value(temp)
temp = temp[2] --check of course if all went well
numberlist = numberlist & temp
end while
return numberlist
and numberlist will have a list of valid integers
at each element location within it...
now, right off, my syntax and choice of getc
as opposed to other get?() functions could be
wrong here.... but i think you get the idear :)
not to mention the fact that the above code won't
even work ;)
hope this helps--Hawke'
|
Not Categorized, Please Help
|
|