---
title: TECCreateSniffer
framework: Core Services
role: symbol
role_heading: Function
platforms: [macOS 10.0+]
path: coreservices/1571832-teccreatesniffer
---

# TECCreateSniffer

Creates a sniffer object and returns a reference to it.

## Declaration

```occ
OSStatus TECCreateSniffer(TECSnifferObjectRef *encodingSniffer, const TextEncoding testEncodings[], ItemCount numTextEncodings);
```

## Parameters

- `encodingSniffer`: A pointer to a sniffer object reference, which is of type doc://com.apple.documentation/documentation/coreservices/tecsnifferobjectref. On return, the reference pertains to the newly created sniffer object.
- `testEncodings`: An array of text encoding specifications supplied by the caller; TECCreateSniffer creates a sniffer that can detect each of these encodings.
- `numTextEncodings`: The number of text encoding specifications in the testEncodings[] array.

## Return Value

Return Value A resultcode. See Result Codes.

## Discussion

Discussion The TECCreateSniffer functionpolls plug-ins for available sniffers, creates a sniffer object capableof sniffing each of the specified encodings that it can find a snifferfunction for, and returns a reference to it. You use this snifferobject reference with sniffer functions such as  TECSniffTextEncoding. If no snifferfunction is available for an encoding, no error is returned and TECSniffTextEncoding indicateslater that the encoding was not examined. To remove a sniffer object, you must call the function  TECDisposeSniffer.

## See Also

### Using Sniffers to Investigate Encodings

- [TECClearSnifferContextInfo](coreservices/1571850-tecclearsniffercontextinfo.md)
- [TECDisposeSniffer](coreservices/1571854-tecdisposesniffer.md)
- [TECCountAvailableSniffers](coreservices/1571795-teccountavailablesniffers.md)
- [TECGetAvailableSniffers](coreservices/1571841-tecgetavailablesniffers.md)
- [TECSniffTextEncoding](coreservices/1571836-tecsnifftextencoding.md)
