Current Page: NeXtMidas Training Primitives Files in a Primitive Getting Files
- - | How to get a file from the command line. Getting a file specified on the command line:
    `MA.getFile(...)` | Gets a `BaseFile` (attempts to get specific subclass of `BaseFile`).
    `MA.getBaseFile(...)` | Gets a `BaseFile` (does not attempt to get a specific subclass).
    `MA.getDataFile(...)` | Gets a `DataFile` (Blue File).
    `MA.getTextFile(...)` | Gets a `TextFile`.
  - Getting a file name specified on the command line:
    `MA.getFileName(...)` | Gets a `FileName`.
- - How to get a file based on a file name. Automatically resolve file type: `BaseFile.getInstanceFor(<ref>, <fileName>)` This will automatically try to resolve the file type (similar to `MA.getFile(...)`). When called from a primitive, `<ref>` should usually be `this`. When called from a library, `<ref>` should usually be a specific `Midas` context. Do it manually: Most of the file types have a constructor that takes in a `<fileName>` and a `<ref>`. This will automatically try to resolve the file type (similar to `MA.getFile(...)`). When called from a primitive, `<ref>` should usually be `this`. When called from a library, `<ref>` should usually be a specific `Midas` context. Get the file in the Primitive's `open()` method. You must open the file before reading any data from it! e.g.
        inFile = MA.getFile("IN");
        inFile.open();