Create and Open the ABF File

The ABF library is used to write to Altair Binary Format files. Before you can write to an ABF file, it must first be initialized. Once the file is initialized, you can create and open the file. When you write to an ABF file, the existing file is overwritten without warning.

If there is only one file name specified on the command line after calling abfCommandLine(), you need not create and open the file. When only an input file name is given (the file to be translated), no output file needs to be created or opened. The ABF library automatically outputs the data to either the standard output stream, stdout, or a connection to an external reader.

Even when there is no open file, an open data stream exists either to stdio or through a pipe to the program. Therefore, if abfOpenFile() is not explicitly called, abfCloseFile() must be called before the translator terminates, except in the case of an error (when abfError() is called).
Note: The ABF library cannot be used to read ABF files.
  1. Initialize the ABF file.
    1. Use abfInit() to initialize the ABF library.
    2. Before the file is created, use abfVersion() to set the version of ABF that will be used.
      Note: If abfVersion() is not called, version 3.0 is the default.
    3. Process the command line passed to your translator’s main() routine. abfCommandLine() removes switches that are handled by ABF library in a standard way.
  2. Use abfCreateFile() to create an ABF file.
  3. Use abfOpenFile() to open the file for output.