Instance Method インスタンスメソッド

initWithFileDescriptor:

Creates and returns a file handle object associated with the specified file descriptor.

Declaration 宣言

- (instancetype)initWithFileDescriptor:(int)fd;

Parameters パラメータ

fileDescriptor

The POSIX file descriptor with which to initialize the file handle. This descriptor represents an open file or socket that you created previously. それでファイルハンドルを初期化するPOSIXファイル記述子。この記述子は、あなたが以前に作成した、開いたファイルまたはソケットを表します。 For example, when creating a file handle for a socket, you’d pass the value returned by the socket function.

Return Value 戻り値

A file handle initialized with fileDescriptor. fileDescriptorで初期化されるファイルハンドル。

Discussion 議論

The file descriptor you pass in to this method isn’t owned by the file handle object. Therefore, you’re responsible for closing the file descriptor at some point after disposing of the file handle object.

You can create a file handle for a socket by using the result of a socket call as fileDescriptor. あなたは、ソケットに対してファイルハンドルを作成することが、socket呼び出しの結果をfileDescriptorとして使うことによって行えます。

See Also 参照

Creating a File Handle ファイルハンドルを作成する

Related Documentation 関連文書