##### Ninja Library - Binary Function

# njOpenBinary

Opens binary file

### FORMAT

`

  Sint8 *njOpenBinary(fname)
  const char *fname

`

### PARAMETER

  `*fname` | File name

### RETURN

  Succeeded | Pointer to work buffer for reading file |
  Failed | NULL if file could not be opened |

### DESCRIPTION

  Opens binary files such as NJ, NJM, etc. on the GD-ROM and returns a pointer to the file read work buffer. The work buffer size is calculated as follows: number of sectors of file on GD-ROM x GD-ROM sector size (2048 bytes) + 8 bytes. This size is used internally by the `syMalloc()` function to get the work buffer and return the value.

### EXAMPLE

      The following opens NJ file on GD-ROM and read texture list and model data.
      Sint8 *w_buff;
      Uint32 rtype, rpos = 0;
      NJS_TEXLIST *tlist;
      NJS_OBJECT *obj;
      char *pFilename = "sample.nu";
      w_buff = njOpenBinary(pFilename);
      tlist = (NJS_TEXLIST *)njReadBinary(w_buff, &rpos, &rtype);
      obj = (NJS_OBJECT *)njReadBinary(w_buff, &rpos, &rtype);
      	:
      	:
      syFree(obj);
      syFree(tlist);
      njCloseBinary(w_buff);

### REFERENCE

  `njReadBinary()
  njCloseBinary()
  `

njOpenBinary

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999