title: Reading record from a text file into array in Pascal
body: <p>1.this is my code i want to read a record from a text file into array in pascal my program is about making a hotel helper and i already have a text file with the data of the hotel then i should read it from the text file and store it in array .. but i am facing error 103 exit code (file not open).... any help Please . :)</p>
  <h2>program Hotel1(input,output);</h2>
  <pre><code>const  max =10;  MaxFloor =10;
  type
  Date = record
          day :1..31;
          month:1..12;
          year:integer;
         end;
  
  
  Booking = record
             Guest:string[20];
             S_Date:date;
             E_date:date;
            end;
  
  
  Booking_Mat= array[1..max] of Booking;
  
  History_Booking = record
                     B_num:integer;
                     B_Mat:Booking_Mat;
                    end;
  
  Room = record
          Num:integer;
          Bed_num:integer;
          Price:integer;
          Status:Boolean;
          H:History_Booking;
         end;
  
  Data = record
         Ro:Room;
         m:integer;
         end;
  
  Data_mat= array [1..max] of Data;
  
  
  
  Procedure  Read_Data(filename:string; var table:Data_mat);
   var   df:text; i,j :integer;
    n,m,num,GN:integer;
    Bed_num,Price:integer;
    f:text;
    s,e:Date;
    Gname:string[20];
    ok:boolean;
    a:Data_mat;
   c:char;
   Begin
   writeln('Reading ',filename,' records into array.... ');
   assign(df,filename);
   reset(df);
  i:=0;
     while (not eof) do
       begin
          i:=i+1;
           Read (f,num);
           a[i].Ro.num:=num;
           Read (f,Bed_num);
           a[i].Ro.Bed_num:=Bed_num;
           Read (f,Price);
        a[i].Ro.Price:=Price;
           Read(f,c);
            if (c ='Y') then
             a[i].Ro.status:= true
         else
             a[i].Ro.status:= false;
  
        readln;
  
    End; {while eof}
    close(df);
  End; {Read_Data}
  </code></pre>