At 8:17 AM +1000 on 12/20/00, Robin wrote: > > One can print out a number in Hex using PRINT HEX$(256), etc. >> > > How does one get the number back out of Hex'ed data? > I was going to mention this before my ISP crashed. The original question was about writing hex data to a file to create a TIFF header and also read that data back. Unless I misunderstand what has been said in this thread, it sounds like you are trying to read and write HEX strings in the data fork. Robert Covington's original post on TIFF code shows this to write the header: /* Write the header */ WriteHexString(fptr,"4d4d002a"); /* Little endian & TIFF identifier */ Instead of dealing with strings, it would seem easier to write the hex data directly. Something like this would write the header: //little endian header DIM headerIBM&`: headerIBM& = 0x4949002a // II // big endian header DIM headerMAC&`: headerIBM& = 0x4d4d002a // MM OPEN "D",#1,"SomePicture.tiff",1,tempVRef,tempDirID WRITE #1, headerMAC&` Some of the data is longer than a single unsigned long. Something like this: /* Compression flag, short int */ WriteHexString(fptr,"010300030000000100640000"); Is shown as this on the <http://www.swin.edu.au/astronomy/pbourke/dataformats/tiff/> 0103 0003 0000 0001 0064 0000 | | | | tag --+ | | | short int -----+ | | one value ----------+ | value of 100 -----------------+ Could be done like this in FB^3: DIM CompressionTag%`: CompressionTag%` = 0x0103 DIM CompressionFieldType%`: CompressionFieldType%` = 0x0003 DIM CompressionNumType&`: CompressionNumType%` = 0x00000001 DIM CompressionValues&`: CompressionValues&` = 0x00640000 WRITE #1, CompressionTag%` WRITE #1, CompressionFieldType%` WRITE #1, CompressionNumType&` WRITE #1, CompressionValues&` Reading the data back should be pretty simple, unless I don't have a clue what Robert is doing.