Opening

# Step 1: Open the file

The first step in any Quicktime operation is to open the file. Include the Quicktime header:

`#include <quicktime.h>`

create a quicktime pointer:

`quicktime_t *file;`

and open the file in read only, read/write, or write mode. The following code opens a file in read only:

`file = quicktime_open("test.mov", 1, 0));`

Argument 1 is the path to a file. Argument 2 is a flag for read access. Argument 3 is a flag for write access. You can specify read, read/write or write access by setting these flags. Only specify read/write for creating new files. Opening an existing file in read/write mode destroys the file.

quicktime_open returns a NULL if the file couldn't be opened or the format couldn't be recognized. Now you can do all sorts of operations on the file.

When you're done doing whatever you do, call

`quicktime_close(quicktime_t *file);
`