macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

getFileSystemRepresentation:maxLength:

INDEX>Foundation>NSString>

ファイルシステムと合う文字列なら、YESを返してbufferに文字列を返します
-(BOOL)getFileSystemRepresentation:(char *)buffer:
         maxLength:(unsigned)maxLength:

解説

ファイルシステムと合う文字列なら、YESを返してbufferに文字列を返します。
(.cや.epsなどの拡張子がついているとNOを返します)

返り値

( BOOL )

YES/NO

引数

( char * )buffer

バッファ

( unsigned )maxLength

最大レンジ

クラス

NSString

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSString *str1 = @"aaa/bbb/ccc.c";
NSString *str2 = @"aaa/bbb/ccc";
char cBuffer1 ;
char cBuffer2 ;
([str1 getFileSystemRepresentation:&cBuffer1 maxLength:13])
                                        ?NSLog(@"YES"):NSLog(@"NO");
NSLog([[NSString alloc] initWithCString:&cBuffer1 ]);

([str2 getFileSystemRepresentation:&cBuffer2 maxLength:13])
                                        ?NSLog(@"YES"):NSLog(@"NO");
NSLog([[NSString alloc] initWithCString:&cBuffer2 ]);
}

@end