freepascal - Pascal - not writing to file -


howdy, pascal masters! i've got file type of custom records:

dbcell = record     name: string[10];     surname: string[15];     balance:integer;     opendate: record         year: integer;         month: 1..12;         day:1..31     end;     accountn: string[10]; end; dbfile = file of dbcell; 

and functions, open , add new element file:

procedure fopenf(var f:dbfile; var fname:string; var fopened:boolean); begin     assign(f,fname);      rewrite(f);      fopened:=true; end;  procedure insn(var f:dbfile;var cell:dbcell;var fopened:boolean); begin         write(f,cell);         close(f);         rewrite(f);         writeln('added');         fopened:=false; end; 

problem is, nothing written file. doing wrong?

the problem 'rewrite' call in insn. 'rewrite' creates new file, calling @ end of program, creating new, empty file!


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -