Re: How to transfer a file in an array



Another ways is just
a) read the bytes into a character array, using one or more unformatted
reads,
b) then read the character array internally as formated integers, using
a format of (nI1).
c) then add 128 to all negative values resulting

What I would do however, is overdefine a character CX and an integer*2
variable ICX (possible using equivalence), initalizing the integer ICX
to 0 then:-
a) read the n bytes into a character array c(n), using one or more
unformatted reads,
b) convert the characters to integer array INT(n):-.

ICX=0
do 1 i=1,n
CX=c(i)
INT(i)=ICX
endo

.



Relevant Pages

  • Re: Converting string to double
    ... This would rely on the garbage text that proceeds the number always ... being in the same format. ... I think it would be better to convert the string to a character array ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Cant print char!
    ... roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) writes: ... > You also are making a mistake by using a %s format to deal with ... > a character array that is not NULL terminated. ...
    (comp.lang.c)
  • Re: How to write a character array to one line in a file?
    ... A character array would be declared like ... there is a difference between an array and a string. ... you'd need quite a different format to solve your problem ... my first.last at org.domain | experience comes from bad judgment. ...
    (comp.lang.fortran)
  • Re: How to transfer a file in an array
    ... Terence wrote: ... read the bytes into a character array, ... then read the character array internally as formated integers, ... variable ICX, ...
    (comp.lang.fortran)