| Home 目次>Foundation>NSFileHandle このサイトはこちらに移転しました。 | |
initWithFileDescriptor:closeOnDealloc:
ファイルデスクリプタでファイルハンドルを初期化して返します
-(id) initWithFileDescriptor:(int)fileDescriptor
closeOnDealloc:(BOOL)flag
【返り値】 | |
| id | ファイルハンドラ |
| 【パラメータ】 | |
| fileDescriptor | ファイルデスクリプタ |
| flag | ファイルを閉じればメモリを解放するかYES/NO |
【解説】
ファイルデスクリプタでファイルハンドルを初期化して返します。
flag がYESなら レシーバが解放されたとき、ファイルディクリプタがクローズされます。
【例文】
handle9 = [[NSFileHandle alloc] initWithFileDescriptor: 1 closeOnDealloc: YES ];
///
socketToRemoteServer = socket(AF_INET, SOCK_STREAM, 0);
if(socketToRemoteServer > 0) {
NSFileHandle * remoteConnection = [[NSFileHandle alloc] initWithFileDescriptor:socketToRemoteServer closeOnDealloc:YES];
![]() | |
この記事を評価してください。
| Home 目次>Foundation>NSFileHandle | 修正日2007.3.26 |