Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Blank space after access to record field ?

Spike89Spike89 Posts: 1Member
Can anyone please help me understand this part of the code
[code]
unit lab5un;
interface
uses LAB5IO;
type MyRec= record
name1 : STR39;
name2 : STR39;
end;
type Myfiletype = file of MyRec;
var MyFileERR :integer;
procedure Fcreate(var fff:Myfiletype; filename:string; var FileOpen: boolean);
procedure Fopenf ( var fff:Myfiletype;filename:string; var FileOpen:boolean);
procedure Fview ( var fff:Myfiletype; FileOpen: boolean);
procedure FRwRec ( var fff:Myfiletype; FileOpen: boolean);
procedure FClose ( var fff:Myfiletype; var FileOpen: boolean);

implementation
uses CRT;
procedure Fcreate(var fff:Myfiletype; filename:string; var FileOpen: boolean);
var RC, n, i: integer;
answer : string[1];
rec :MyRec;
label BUILD;
begin
assign(fff, filename);
{$I-}
RC:=13;
reset(fff);
{$I+}
RC:=ioresult;
if (RC=0) then
if (FileRewr(filename) = FALSE) then
begin
close(fff);
FileOpen:=False;
MyFileErr:=1;
exit;
end;

{$I-}
rewrite(fff);
{$I+}
if(IOResult<>0) then begin
MyFileErr:=3;
FileOpen:=False;
exit;
end;
n:=NumOfRec;

Rec.Name1:=' ';
Rec.Name2:=' ';
for i:=0 to n do
begin
Rec.name1:= chr($61 +i);
Rec.name2:= chr($30 +i);
write(fff,Rec);
end;
close(fff);
FileOpen:=False;
end;
[/code]

in particular this part
[code]
Rec.Name1:=' ';
Rec.Name2:=' ';
[/code]
i understand that rec.name gives acces to information in records name1 field but why is there :=' '; after its puzzling me

Comments

  • ROCK_ROCK_ Posts: 11Member
    ':=' is used to assign value into variable/ record.....its same like assigning value into variable...e.g
    var num : integer;
    num:= 10;

    in above example u r assigning value 10 to variable..in similar way we assign vale to record...imagine record like a field, where u can assign different values in different field....but u have to tell the location where u wanna store the vale

    Myrec.name1:='Peter';

    this says that u r storing peter into name1(which accepts string) and its a record type.

Sign In or Register to comment.