| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > ASCIIFileClass > AsciiFileClass Methods >====== Init (initialize the ASCIIFileClass object) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[getpercentile convert file position to percentage asciifileclass .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[kill shut down the asciifileclass object .htm|{{btn_next_n.gif|Next page}}]] | | || **Init( **//file, field //[//,filename//]//, error handler //**)** {{blk2blue.jpg|blk2blue.jpg}} | **Init** | Initializes the ASCIIFileClass object. | | //file// | The label of the file to display. | | //field// | The fully qualified label of the //file //field to display. | | //filename// | The label of the //file//'s NAME attribute variable. If omitted, the //file //has a constant NAME attribute. If null (''), the ASCIIFileClass prompts the end user to select a file. | | //error handler// | The label of the ErrorClass object to handle errors encountered by this ASCIIFileClass object. | The **Init **method initializes the ASCIIFileClass object and returns a value indicating whether it successfully accessed the //file// and is ready to proceed. **Implementation:** The Init method returns one (1) if it accessed the //file// and is ready to proceed; it returns zero (0) and calls the Kill method if unable to access the //file //and cannot proceed. If the Init method returns zero (0), the ASCIIFileClass object is not initialized and you should not call its methods. **Return Data Type:     **BYTE **Example:** **Filename   STRING(255),THREAD           !declare filename variable** **FileActive BYTE                         !declare success/fail switch** **AsciiFile  FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1)** **RECORD      RECORD,PRE()** **Line         STRING(255)** **            END** **           END** ** CODE                                      !init ASCIIFileClass object with:** ** FileActive=ASCIIFile.Init(AsciiFile,    | ! file label** **              A1:Line,                   | ! file field to display** **              Filename,                  | ! NAME attribute variable** **              GlobalErrors)                ! ErrorClass object** ** IF ~FileActive THEN RETURN.               !If init failed, don't proceed** ** ACCEPT                                    !If init succeeded, proceed** **  IF EVENT() = EVENT:CloseWindow** **   IF FileActive THEN ASCIIFile.Kill.      !If init succeeded, shut down** **  END** **  !program code** ** END** **See Also:     **[[kill shut down the asciifileclass object .htm|Kill]]