open()

Kenneth Brody kenbrody at spamcop.net
Thu Mar 6 06:52:32 PST 2014


On 3/5/2014 7:28 PM, Scott wrote:
> Hi all
>
> Can anyone please explain the use of open () or create() with the
> writeline()  commands please.
[...]
> Yet each time a new record is done in the rreport it dumps over previous
> lines/file.
>
> FP Ver 4.8.13 Windows
>
> ::'FILEPRO TO MYSQL DUMP:
>
> ::co (1,.0,g); cx (8,.0) = "1":
> :'file fields count:fc (3,.0) = NUMFIELD(-):
> ::lf = open("c:/fp/output/mysql_dump.txt","rwc"):
[...]

You execute the OPEN() on every record.  By default, the "current position" 
is placed at the beginning of the file when initially opened.  Therefore, 
every record starts writing from the beginning of "mysql_dump.txt".

Make the file handle "global" (use the ",g" flag in its definition), and 
only call OPEN() on the first record.  Then each record will continue to 
write from where the previous one left off.

-- 
Kenneth Brody


More information about the Filepro-list mailing list