# `GSInstance saveToFile:format:context:error:`

*Instance Method*

Saves the instance to a file with the specified format version.

## Declaration

```swift
func save(to file: UnsafeMutablePointer<FILE>, format formatVersion: GSFormatVersion, context: GSSaveContext) throws
```

```objc
- (BOOL) saveToFile:(FILE *) file format:(GSFormatVersion) formatVersion context:(GSSaveContext *) context error:(NSError **) error;
```

```python
saveToFile_format_context_error_(file: FILE, formatVersion: GSFormatVersion, context: GSSaveContext) -> tuple[bool, NSError]
```

## Parameters

- `file` — The file to save to.
- `formatVersion` — The format version to use.
- `error` — A pointer to an NSError object to store any error that occurs.

## Return Value

YES if the save operation is successful, NO otherwise.

