I'm having a problem writing and reading files. Will someone please check the following. In particular the WRITE FILE and READ FILE syntax. The array data is OK before it is saved, but it is corrupt when I read it. The number of records reads correctly with LOF(1) Thanks Barrie LOCAL FN SaveDataRecord dim as long dataBytes,recordSize,timeBytes,locationBytes FN getDateAndTime DEF OPEN ="DataCHMK" dataBytes = ((_maxAnswers+1)*(_maxQuestions+1)) * SIZEOF(INT) timeBytes = SIZEOF(INT) * 6 locationBytes = SIZEOF(gLocation$) recordSize = dataBytes + timeBytes + locationBytes OPEN "A",1,gSurveyDataFile$,recordSize,0 PRINT #1,gLocation$ WRITE FILE #1, @gTimeStamp%(0),timeBytes WRITE FILE #1, @gData%(0,0),dataBytes CLOSE #1 def blockfill(@gData(0,0), (_maxAnswers+1) * (_maxQuestions+1) * sizeof(gData(0,0)), 0) END FN LOCAL FN ReadDataRecord(recordNum,positionInRecord) dim as long dataBytes,recordSize,timeBytes,locationBytes dataBytes = ((_maxAnswers+1)*(_maxQuestions+1)) * SIZEOF(INT) timeBytes = SIZEOF(INT) * 6 locationBytes = SIZEOF(gLocation$) recordSize = dataBytes + timeBytes + locationBytes DEF OPEN ="Data" gSurveyDataFile$ = FILES$ (_fOpen,"Data","Open Data file",gFileVol) IF gSurveyDataFile$ = "" THEN exit fn OPEN "I",1,gSurveyDataFile$,recordSize,gFileVol gNumberOfRecords = LOF(1) RECORD 1,recordNum ,positionInRecord INPUT #1,gLocation$ READ FILE #1, @gTimeStamp%(0),timeBytes READ FILE #1, @gData%(0,0),dataBytes CLOSE #1 END FN