Reading and writing files
Posted on 1999-01-16
I have a file type declaration as follows.
CustomerData = record
ACNumber : string;
Name : string;
Credit : integer;
CustomerFile = file of CustomerData;
Now I want to create a file if it does not already exist and associate it with the file variable ( CustomerFile ) and I have problem with calling procedure assign
assign(CustomerFile, 'C:\temp\hello.dat' );
It comes up with a compiler error saying that after first parameter a '(' is expected.
Where I am getting wrong?
If I replace CustomerFile with a text file declared as F: file, then it works, but I don't want a text file I want a typed file containing my customer records.
This is sort of a database - is there a better way to do it. If I am on the right path then what is this error??
Can anybody give me code to open a file, write records to it close it, open it again and read the records and displayb them
Thanks in advance