Silverfrost Forums

Welcome to our forums

How to find the memory space occupied by a TYPE structure

1 May 2009 10:00 #4511

I'm away from my office (where the FTN95 manual is!) and I need to be able to update the contents of a structure, when I only have access to its address.

Currently, I have:

TYPE (RSCA) :: SCALAR . .

SCALAR = TRANSFER(CORE4(IADDRESS), SCALAR)

Which successfully COPIES the databytes at IADDRESS into the SCALAR structure. But SCALAR is at a different address to IADDRESS. So, when I make a change to SCALAR%STR, that doesn't affect the data at IADDRESS. So, how do I transfer the changed information back to IADDRESS?

I have a function called CopyBytes, which just calls

MOVE@ (CCORE1(IAD1), CCORE1(IAD2), N)

But I need to know what to set 'N' to. I could just look at my TYPE definition for RSCA and add them up, but, if possible, I'd prefer to have code to do it for me, in case I change the TYPE definition.

I'm sure it's simple, but I just can't find any reference to how to do it!

Thanks

K

1 May 2009 2:47 #4518

I think you can use INQUIRE together with the keyword argument IOLENGTH. Just like a WRITE statement.

INQUIRE(IOLENGTH=IOL) <iolist>

where IOL is an integer to receive the length in bytes probably.

2 May 2009 6:36 #4520

Thank you. Works perfectly.

K

Please login to reply.