csvファイルの内容を確認するアプリを作成しています。行と列を正しくチェックできます。ここで、ファイル全体が空かどうかを調べたいと思います。
1563 次
1 に答える
6
「空」とは、何も含まれていない (0 バイト) ことを意味する場合、次のようにすることができます。
NSFileManager *manager = [NSFileManager defaultManager];
if ([manager fileExistsAtPath:path]) {
NSDictionary *attributes = [manager attributesOfItemAtPath:path error:nil];
unsigned long long size = [attributes fileSize];
if (attributes && size == 0) {
// file exists, but is empty.
}
}
于 2012-10-02T18:36:34.087 に答える