fileSystemRepresentation
解説
パス名だと見て、ファイルシステムが使う(Unixなら"/"と"."など)文字コードに変換したC文字列を返します。
レシーバが解放されると帰り値のC文字列も解放されます。
用意したメモリ領域にC文字列を書き込むには– getFileSystemRepresentation:maxLengthを使います。
返り値
( const char * )
C文字列
引数
フレームワーク
Foundation
クラス
NSString
Instance Methods
使用可能
10.0
参照
例文
#pragma mark iOS NSString fileSystemRepresentation -(void)method017 { NSString *str1 = [[NSString alloc] initWithString:@"~/tmp/scratch.tiff"]; const char *str = [str1 fileSystemRepresentation]; NSLog(@"%s %p , %s",__FUNCTION__,str1,str); //=>-[OOOAppDelegate method017] 0x539e8 , ~/tmp/scratch.tiff }