BBS: Inland Empire Archive Date: 03-21-92 (17:17) Number: 130 From: MATT HART Refer#: NONE To: JIM CASSARO Recvd: NO Subj: Help Conf: (2) Quik_Bas
JC> I need some source code that will goto a specified line in a
JC> straight ASCII file an replace a 0 with a 2. I run a door on my
JC> BBS designed for WildCat BBS software, and I use SuperBBS. The
JC> program I use to convert DORINFO1.BBS to DOOR.SYS, place a 0 for
JC> the amount of files downloaded. I would like to change this to a
JC> 2. Any help would greatly be appreciated. BTW, the 0 is on line
JC> 25 of the ASCII file.
Is this a sequential file or a binary file? Is that byte
on line 25 always at the same location - I.E. 300 bytes
into the file (or whatever)? If so, you can use a binary
PUT to change it:
OPEN "B",1,FileName$
SEEK 1,300
A$ = "2"
PUT 1,,A$
CLOSE
If it is a sequential file, you can input the lines and
save to a temporary file until line 25, and then change it:
OPEN "I",1,FileName$
OPEN "O",2,TempFile$
FOR i = 1 TO 24
LINE INPUT #1,A$
PRINT #2,A$
NEXT
LINE INPUT #1,A$
PRINT #2,"2"
DO UNTIL EOF(1)
LINE INPUT #1,A$
PRINT #2,A$
LOOP
CLOSE
KILL FileName$
NAME TempFile$ AS FileName$
Make sure that TempFile$ and FileName$ are on the same
drive as the NAME command does not work across drives, but
does work across directories.
--- DB B1061/002106
* Origin: Midnight Micro! V.32 <<<Stereo>>> (1:170/600)

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