From: ken qaws on 19 Feb 2010 18:41 On Feb 19, 1:39 pm, nos...(a)see.signature (Richard Maine) wrote: > e p chandler <e...(a)juno.com> wrote: > > > Maybe. A formatted file is a file of text records. LF is being > > translated to CR/LF on output in this case even though you specify '$' > > which is a non-standard edit descriptor for suppress end-of-line. > > That would be normal. Of course, as noted, the $ edit descriptor is > non-standard, so pretty much nothing can be guaranteed, but the "normal" > expectation would be that it just act like advance='no', which > suppresses the otherwise automatic end-of-record that you get at the end > of the write. It does not suppress record ends generated for any other > reason, including / edit descriptors, format reversion, or writing > newline characters to the file as data. > > The OP is trying to write what is inherently unformatted data. Using > formatted I/O for that is full of problems, this being only one of them. > > > Before trying to answer your question directly, let me suggest that > > you upgrade to g95 or gfortran. They both support "stream" I/O - a > > Fortran 2003 construct - which allows reading and writing single raw > > bytes. (access='stream'). Other compilers have other non-standard ways > > of accomplishing this as well. > > Yes. I strongly recommend that as the preferred general direction - > either the f2003 standard stream I/O or one of the earlier > compiler-specific variants. > > > If you are restricted to G77, you could try a direct access file with > > a record length of 1 byte. I think it's formatted but I don't use this > > feature. > > Direct access is either formatted or unformatted, whichever you specify, > just like sequential. Unformatted is what you want. > > -- > Richard Maine | Good judgment comes from experience; > email: last name at domain . net | experience comes from bad judgment. > domain: summertriangle | -- Mark Twain Thanks for all the great advice, guys! I installed g95, and I'm writing the bitmap file using form='unformatted', access='stream'. It works perfectly. |