I’m trying to WRITE the content of several double precision arrays of variable length to a character variable just like I would to a physical file using an unformatted write. Writing to a physical file works like I expected it to but I’d like not to rely on a physical file.
Is this possible using Fortran’s WRITE statements? Or do I have to cook up my own writing routines?
This is roughly what I’m doing with the physical file:
INTEGER, PARAMETER :: u = 400
INTEGER :: ios
DOUBLE PRECISION, DIMENSION(:,:), POINTER :: pd_test1
DOUBLE PRECISION, DIMENSION(:), POINTER :: pd_test2
ALLOCATE(pd_test1(3,4))
ALLOCATE(pd_test2(5))
OPEN(UNIT=u, FILE="test.bin", ACCESS='stream', STATUS='replace', ACTION='write', IOSTAT=ios)
WRITE(u, iostat=ios) pd_test1, pd_test2
I’d like to have the contents of that file “test.bin” in a character variable without having to write the file and read from it.