---
title: "CFReadStreamCreateWithFile(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfreadstreamcreatewithfile(_:_:)"
---

# CFReadStreamCreateWithFile(_:_:)

Creates a readable stream for a file.

## Declaration

```swift
func CFReadStreamCreateWithFile(_ alloc: CFAllocator!, _ fileURL: CFURL!) -> CFReadStream!
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `fileURL`: The URL of the file to read. The URL must use the file scheme.

## Return Value

Return Value The new readable stream object, or NULL on failure. Ownership follows the The Create Rule.

## Discussion

Discussion You must open the stream, using CFReadStreamOpen(_:), before reading from it.

## See Also

### Creating a Read Stream

- [CFReadStreamCreateWithBytesNoCopy(_:_:_:_:)](corefoundation/cfreadstreamcreatewithbytesnocopy(_:_:_:_:).md)
