BBS: Inland Empire Archive Date: 09-18-92 (10:40) Number: 300 From: SCOTT BAILEY Refer#: NONE To: BOBBY MORGAN Recvd: NO Subj: datafiles Conf: (2) Quik_Bas
Here's a quickie I wrote for ya. This will work with any size data file. Don't forget to backup your data files often! -----clip-it-here-------- 'by Scott Bailey 18/10/92 'Public Domain ON ERROR GOTO caught ?:? CR$=CHR$(13):buffer=8192 B$=STRING$(buffer," ") name$="Scott Bailey"+CR$ 'new data to add to file desc$="No description!"+CR$ 'with carriage return filedata$="data.dat" newfiledata$="data2.dat" OPEN filedata$ FOR BINARY AS #1 x=LOF(1) IF x=0 THEN ? filedata$;" doesn't exist!":CLOSE:KILL filedata$:END OPEN newfiledata$ FOR BINARY AS #2 PUT #2,,name$ PUT #2,,desc$ tt=x/buffer ? FOR y=1 TO tt GET #1,,B$ PUT #2,,B$ sk=SEEK(1) ? sk 'just to show postion NEXT g$=STRING$(x-sk+1," ") GET #1,,g$ PUT #2,,g$ sk=SEEK(1) ? sk CLOSE KILL filedata$ 'kill old data file so we can rename new file to old NAME newfiledata$ AS filedata$ 'give new data file old name ? "complete...": ? OPEN filedata$ FOR INPUT AS #1 FOR h=1 TO 10 'read first 10 lines of new file just INPUT #1,a$ 'to show new data is there. Any data with a ,; etc. ? a$ 'must be enclosed in quotes before writing to disk NEXT 'ex: chr$(34)+"description; 1,2,3"+chr$(34) END caught: ? "ERROR! Number";ERR:CLOSE:END -------clip-'er-here--------- $cott Bailey --- DLG Pro v0.992/DLGMail * Origin: Computer Answers, Prince Albert, Sask., Canada (1:140/74)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET