NSFileManager:fileSystemRepresentationWithPath:
Home 目次>Foundation>NSFileManager このサイトはこちらに移転しました。

fileSystemRepresentationWithPath:

指定したパスの内容を表すC文字列を返します


-(const char *) fileSystemRepresentationWithPath:(NSString *)path


【返り値】
   const char *C文字列
【パラメータ】
   pathパス


【解説】

指定したパスの内容を表すC文字列を返します。



【例文】


#import "MyObject.h"

@implementation MyObject

- (
IBAction )myAction:( id )sender
{
//OSType *ost;
NSFileManager *myFile = [ NSFileManager defaultManager];
const char *cStr;
// 開けるファイル拡張子の配列
NSArray *imgTypes = [ NSArray arrayWithObject :
@"tiff" ];
//OpenPanel を作る
NSOpenPanel *opImage = [ NSOpenPanel openPanel ];
//OpenPanel の結果のボタン番号
int opRet;

//OpenPanel でファイル選択
opRet = [ opImage runModalForDirectory : NSHomeDirectory()
// どこのディレクトリを出すか
file :
@"Pictures" // どのファイルを選択しておくか
types : imgTypes ];
// 選べるファイルタイプ

if ( opRet == NSOKButton ) { // OPENPanel のボタンが OK なら


cStr = [myFile fileSystemRepresentationWithPath:[[ opImage filename ] stringByExpandingTildeInPath]];


NSLog([NSString stringWithCString:cStr]);
}
}


@end


(C) 2000-2009 Satoshi Oomori.
[Apple]

Google
Webwww.oomori.com
Apple_Store_40x120

[ad:Usual day in Japan]

この記事を評価してください。 

良い 

間違いがある 説明がわかりにくい 例文がわかりにくい  

Home 目次>Foundation>NSFileManager
修正日2006.12.26