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


The **GW2DetermineFileTypeAndReport** function determines the file type for a given file and produces a report. This is not related to a session.

<Tabs>

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

```cpp
#include "glasswall.core2.api.h"
ft_t GW2DetermineFileTypeAndReport(const char *inputFileBuffer, size_t inputLength, const char *report)
```

**Parameters**

&emsp; **inputFileBuffer** The memory location containing the file to be processed by this function.

&emsp; **inputLength** The length of `inputFileBuffer` in bytes

&emsp; **report** The path to a plain text file where the report will be written. If the file doesn't exist it will be created.

**Returns**

&emsp; Enumerated type `ft_t` indicating the determined file type. If the file type cannot be determined then `ft_unknown` will be returned.

</TabItem>

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

**Synopsis**

**Returns**

</TabItem>

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

**Synopsis**

```java
public int GW2DetermineFileTypeAndReport(byte[] fileBuffer, String reportFilePath) throws GlasswallException, NullPointerException
public int GW2DetermineFileTypeAndReport(byte[] fileBuffer, int length, String reportFilePath) throws GlasswallException, NullPointerException
```

**Description**

The **GW2DetermineFileTypeAndReport** function determines the file type of the file held in the byte array `fileBuffer` and writes out a summary XML report to the path specified in `reportFilePath`. The `length` of the `fileBuffer` may optionally be specified.

**Returns**

The **GW2DetermineFileTypeAndReport** function returns an integer indicating the determined file type. A list of the enumeration constants is in the C source header file **filetype.h**. A return value of 0 indicates the file type can't be determined.

If successful, an XML report will be written to the path specified in `reportFilePath`.

A **NullPointerException** exception will be thrown if `fileBuffer` or `reportFilePath` buffers are null or empty.

A **GlasswallException** exception will be thrown if `fileBuffer` cannot be retrieved, or if the `reportFilePath` could not be converted to UTF-8.

</TabItem>

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

**Synopsis**

**Returns**

</TabItem>

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

**Synopsis**

**Returns**

</TabItem>

</Tabs>