---
title: "stat(_:_:)"
framework: system
role: symbol
role_heading: Type Method
path: "system/cinterop/stat(_:_:)"
---

# stat(_:_:)

Calls the C stat() function.

## Declaration

```swift
static func stat(_ path: UnsafePointer<CChar>, _ s: inout CInterop.Stat) -> Int32
```

## Parameters

- `path`: A null-terminated C string representing the file path.
- `s`: An inout reference to a CInterop.Stat struct to populate.

## Return Value

Return Value 0 on success, -1 on error (check Errno.current).

## Discussion

Discussion This is a direct wrapper around the C stat() system call. For a more ergonomic Swift API, use Stat instead. warning: This API is primarily intended for migration purposes when supporting older deployment targets. If your deployment target supports it, prefer using the Stat API introduced in SYS-0006, which provides type-safe, ergonomic access to file metadata in Swift.
