Routines (alphabetical) > Routines: H > HDF-EOS Routines > EOS_SW_OPEN

# EOS_SW_OPEN

This function creates a new file or opens an existing file.

## Examples

In this example, we create a new swath file named, SwathFile.hdf. It returns the file handle, fid:

fid = EOS_SW_OPEN("SwathFile.hdf", /CREATE)

## Syntax

Result = EOS_SW_OPEN( filename [, /CREATE] [, /RDWR | , /READ] )

## Return Value

Returns the swath file id handle (fid) if successful and FAIL (–1) otherwise.

## Arguments

### filename

Complete path and filename for the file to be opened (string).

## Keywords

### CREATE

If file exists, delete it, then open a new file for read/write.

### RDWR

Open for read/write, If file does not exist, create it.

### READ

Open for read only. If file does not exist, error. This is the default.

## Version History

5.2 | Introduced