This may sound really silly, but i havent worked with append files in maybe 15 years+.
Write and read is simple, but can you DELETE an entire line within that append file?
When an entire line of info is no longer needed for example.
In a Random file thats pretty easy.
If i simply save blanks then it still reads a line of records.
I am really not quite sure how you would "cut" that line from the file.
:-[ I cant remember much of this!!
Opening a file for APPEND basically means that you will have to deal with the file using sequential access. If the files are manageable, what I normally do is read the entire file into an ARRAY (PB has some great functions that make this extremely easy), and then manipulate each element of the string array. The item's array index corresponds to the line number within the file. When you are finished manipulating the array, simply write it back to disk. With today's extremely fast hard drives, large memory caches, and gigs of main memory - this process is usually lightning fast.
Append is only capable of adding to the end of the file.
This is a sample of copy line by line of a text file:
#COMPILE EXE
FUNCTION PBMAIN () AS LONG
OPEN "file1.txt" FOR INPUT AS #1
OPEN "file2.txt" FOR OUTPUT AS #2
DO WHILE NOT EOF(1)
LINE INPUT #1,A$
INCR LINE&
IF LINE&=10 THEN ITERATE DO ' You can put a condition for exclude or include a line.
PRINT #2,A$ ' sample: IF INSTR(A$,"Any text")>0 THEN ITERATE DO
LOOP
CLOSE
'Other sample read with BINARY
OPEN "file1.txt" FOR BINARY AS #1
DATAFILE$=SPACE$(LOF(1))
GET #1,1,DATAFILE$
CLOSE #1
OPEN "file2.txt" FOR OUTPUT AS #2
COUNTLINES&=PARSECOUNT(DATAFILE$,$CRLF)
FOR X&=1 TO COUNTLINES&
IF X&=10 THEN ITERATE FOR ' You can put a condition for exclude or include a line
LINE$=PARSE$(DATAFILE$,$CRLF,X&)
PRINT #2,LINE$
NEXT X&
END FUNCTION