title: Delphi7, I/O error 102, When Assigning a file
body: <p>My teacher assigned me to create a simple project: Create a form, which the user has to complete and when he presses the submit button, then the program should write all the information in different textfiles (For example, 1 textfile for their first name, onother for their last name etc) (i know it sounds insane, but a project is a project). Anyway, i tried this:</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);   //On Click
  var 
  F:Array[1..20]of textfile;                        //20 fields, 1 txt each one
  Firstname,Fname:string;                           //Location,Field
  
  Begin
  Firstname:=ExtractFilePath(Paramstr(0))+'User\Identity\FirstName.txt'; //Location
  Fname:=Edit1.text;
  
  AssignFile(f[1],Firstname);
  Rewrite(f[1],Firstname);
  writeln(f[1],Fname);
  closefile(f[1]);
  end;
  </code></pre>
  
  <p>I searched on the google about this error: </p>
  
  <blockquote>
    <p>I/O error 102,</p>
  </blockquote>
  
  <p>All i found is that delphi does not assign the file, for some reasons. But i still don't get why, the code looks absolutely correct and logical to me, Perhaps what i tried:</p>
  
  <blockquote>
    <p>F:Array[1..20]of Textfile is wrong, the only reason i tried it, is because i wanted to start writing f1,f2,...,f20</p>
  </blockquote>
  
  <p>What do you think i should do? Thanks</p>