> Date: Mon, 26 Jul 2004 16:56:04 -0400 > From: Aleksandar Donev <[log in to unmask]> > Hi, > > A simple unformatted IO question (I am sure the answer must be simple). > How do I read a file of unformatted integers one by one, in a do loop? > That is, this is a grayscale image where the pixel values (0-256, > unsigned char's in C) are stored in one file without any spaces or > newlines or such. The problem of reading and writing picture files is handled in several examples in my book, "Algorithms and Data Structures in F and Fortran", published by Unicomp. The ISBN is 0-9640135-4-1. The book may be purchased online at http://www.fortran.com The specific examples include PCX and TIFF file processing. > I want to avoid reading them all at once into an > array (it is a large file), and don't know how to do "nonadvancing" > unformatted input. I know that I have to take care of unsigned/signed > conversion myself. BTW, the range for a byte is 0-255, and the intrinsics CHAR and ICHAR can do the conversions. > Thanks, > Aleksandar > -- > __________________________________ > Aleksandar Donev > Complex Materials Theory Group (http://cherrypit.princeton.edu/) > Princeton Materials Institute & > Program in Applied and Computational Mathematics > @ Princeton University > Address: > 419 Bowen Hall, 70 Prospect Avenue > Princeton University > Princeton, NJ 08540-5211 > E-mail: [log in to unmask] > WWW: http://atom.princeton.edu/donev > Phone: (609) 258-2775 > Fax: (609) 258-6878 > __________________________________ >