GSoC '25: stdlib filesystem

I played around with your code a little. One thing I noticed is that if you write out the file(1) values, the complex number gets written out as four characters not the eight I would expect for the 8 bytes required to store a REAL32 complex number. This puzzled me until I used TRANSFER to move (3.0, -4.0) into an array (size 8) of 1 byte characters and then used ICHAR to look at the resulting integer values for each character. For (3.0, 4.0) the first two bytes are 0 which translates into a non-printable NULL character in the ASCII Character set. Fortran obviously doesn’t care about this when you do an internal READ on the resulting data. However, what would happen in say a VTK XML file if you used your method to mix binary data with the XML text that would then be read by a C or C++ code. Wouldn’t there be a couple bytes missing or am I not seeing something obvious here. Note if you write (3.1, -4.1) you get 8 characters printed instead of 4. VTK lets you use either raw binary or base64 encoded values for binary data in their XML files. I also suspect that the list directed output also plays a role in this behaviour since it apparently skips the non-printable characters. Having to do tricks like this and/or use something like base64 encoding is why I think Fortran needs some intrinsic capability to mix text and binary but again I don’t see that ever happening. I guess you could do this with stream IO but i’ve never taken the time to work out the best way to do that.