R
Ruud Baltissen
Hello,
The Pascal equivalent of struct is record. It is possible to nest records inside other records, just like with structs. Assume record Drive0 is nested inside record Device and has the elements InUse and PCfile:
Device = record
...
...
Drive0 = record
InUse : boolean;
PCfile : string;
...
end;
...
end;
If I want to access PCfile of Drive0 I could do it like this:
Device.Drive0.PCfile := "D:\disk.ima";
In C it would look about the same. But in Pascal there another way:
with Device do
begin
...
...
with Drive0 do
begin
InUse := True;
PCfile := "D:\disk.ima";
end;
end;
This comes in handy when handling a lot of elements in one go, for example: when initializing a drive.
I'm looking for a C equivalent of this "with" construction. All programming examples I saw so far always showed the complete structure. Is there an equivalent or not?
Thank you for your time and info!
Kind regards, Ruud Baltissen
www.Baltissen.org
The Pascal equivalent of struct is record. It is possible to nest records inside other records, just like with structs. Assume record Drive0 is nested inside record Device and has the elements InUse and PCfile:
Device = record
...
...
Drive0 = record
InUse : boolean;
PCfile : string;
...
end;
...
end;
If I want to access PCfile of Drive0 I could do it like this:
Device.Drive0.PCfile := "D:\disk.ima";
In C it would look about the same. But in Pascal there another way:
with Device do
begin
...
...
with Drive0 do
begin
InUse := True;
PCfile := "D:\disk.ima";
end;
end;
This comes in handy when handling a lot of elements in one go, for example: when initializing a drive.
I'm looking for a C equivalent of this "with" construction. All programming examples I saw so far always showed the complete structure. Is there an equivalent or not?
Thank you for your time and info!
Kind regards, Ruud Baltissen
www.Baltissen.org