Dear ALL,

Could you tell me how can I write a program that writes to a text file, the 32 people that are in our hotSeat.txt file.

Cheers,

turbomen

(p.s.: 'the question orginally ask me to write a program that writes to a text file, the 32 people that are in our hotSeat.dat file' but it is not possible for me to upload the *.dat file to here. So, I have make changes of the *.dat file to *.txt file before upload it.)

What are you using Turbo Pascal or Delphi? If Turbo Pascal...look at AssignFile/Append/CloseFile

if Delphi...use TFileStream

something like
aStream.Write(Pointer(aStringToWrite)^, length(aStringToWrite));

Hi,

Thank you for your kind reply. I am using Borland Delphi but what is TFileStream?

Cheers,

first you have to know the record's field,if you know then you can use a for loop to write the guy to the file....
By the way,when we want to write records into a file then we do it with typed file,same typed as the record....

Simple example...

a_FileStream := TFileStream.Create(FFileName, fmCreate);
  try
    for a_Index := Low(a_RecordArray) to High(a_RecordArray)
    begin
       aStream.Write(Pointer(a_RecordArray[a_Index].LastName)^, length(a_RecordArray[a_Index].LastName)); 
    end;
  finally
    a_FileStream.Free;
  end;
This question has already been answered. Start a new discussion instead.