Question

Howdy, Pascal masters! I've got a 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, that open and add new element to 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 is actually written to file. What am I doing wrong?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top