import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'


The **GW2RegisterExportFile** function registers a specified file path to session - the exported data will be placed in that file. Using this function activates the Export Process Mode for the session.

<Tabs>

<TabItem value="C++" label="C++" default>

**Synopsis**

The **GW2RegisterExportFile** function registers the file whose name is the string pointed to by **exportFilePath** with the session denoted by **session.** The exported data will be placed in that file. Using this function activates the Export Process Mode for the session.

```cpp

#include "glasswall.core2.api.h"
int GW2RegisterExportFile(
    Session session,
    const char *exportFilePath);

```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

<TabItem value="C#" label="C#">

**Synopsis**

```csharp
public int RegisterExportFile(
    int session,
    string exportFilePath)

```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

<TabItem value="Java" label="Java">

**Synopsis**

```java
import com.glasswall.core2javabridge.*;

public int GW2RegisterExportFile(int session, String exportFilePath) throws GlasswallException, NullPointerException

(Deprecated)
public int GW2RegisterExportFile(int session, byte[] exportFilePath) throws GlasswallException, NullPointerException
```

**Note**

The **GW2RegisterExportFile** function parameters have been updated to use `String` in place of `byte[]`. The original function has been deprecated.

**Returns**

The **GW2RegisterExportFile** function returns a **GW2_RetStatus** enumeration converted to `int`. The value will be negative if an error occurred. `0` indicates success. Refer to the API Overview/Return types for details. 

A **NullPointerException** exception will be thrown if `exportFilePath` is null or empty.

A **GlasswallException** exception will be thrown if `session` is invalid, if the `exportFilePath` could not be retrieved, or if the `exportFilePath` could not be converted to UTF-8.

</TabItem>

<TabItem value="Python" label="Python">

**Synopsis**

Registers a file to be exported for the given session. The export file will be created during the session's run_session call.

```py
def register_export(self, session: int, output_file: Optional[str] = None):
    """ Registers a file to be exported for the given session. The export file will be created during the session's run_session call.

    Args:
        session (int): The session integer.
        output_file (Optional[str]): Default None. The file path where the export will be written. None exports the file in memory.

    Returns:
        gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call and 'session', the session integer. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
    """
```

**Returns**

gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call and 'session', the session integer. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.

The status attribute is an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

<TabItem value="JavaScript" label="JavaScript">

**Synopsis**

This function registers a specified export file with a specified session

```jsx

/**
* @param {number} session The ID of the session.
* @param {string} exportFilePath The path of the file to be registered.
*/

GW2RegisterExportFile(session, exportFilePath)

```

**Returns**

Returns an integer `GW2_RetStatus` enum value. Negative numbers indicate a failure.

</TabItem>

</Tabs>