' Program for adding data to a binary file. ' Roger Hedin ' 'Here we make our own type. Just like an integer or float. In C it is called struct. TYPE latlong code AS INTEGER lat AS INTEGER lon AS INTEGER END TYPE 'Make a variabel of the type latlong DIM lalo AS latlong 'This is the database we shall work with. infile$ = "mapper.pnt" 'Open file for writing/reading OPEN infile$ FOR RANDOM AS #1 LEN = LEN(lalo) InData: CLS items = LOF(1) \ LEN(lalo) PRINT "Number of items = "; item PRINT "Beginning of line -> lalo.code > 1000." PRINT "ENTER = Add item, Other key = End" PRINT PRINT TAB(10); "CODE"; TAB(19); "Lat (N+ S-)"; TAB(34); "Long (E+ W-)" 'Show the 10 last fileds Skip this part if you start a new file (items < 10) FOR cnt = (items - 10) TO items GET #1, cnt, lalo PRINT cnt; TAB(10); lalo.code; TAB(20); lalo.lat / 60; TAB(35); lalo.lon / 60 NEXT cnt PRINT q$ = UCASE$(INPUT$(1)) IF ASC(q$) <> 13 THEN 'Not ENTER - END CLOSE #1 END ELSE 'You pressed ENTER LOCATE 18, 10: INPUT ; "", code LOCATE 18, 20: INPUT ; "", latgr LOCATE 18, 35: INPUT ; "", longr PRINT PRINT "Post :"; cnt, "Lat :"; latgr, "Long: "; longr PRINT "ENTER = OK to store, Other key = Rewrite " q$ = UCASE$(INPUT$(1)) IF ASC(q$) = 13 THEN ' Enter pressed - store item lalo.code = code lalo.lat = latgr * 60 lalo.lon = longr * 60 PUT #1, cnt, lalo END IF END IF GOTO InData ' End of program