0

fseek()大きなファイル用のクロスプラットフォームはありますか? 制限を超えると、シークは失敗し2GBます。

size_t chunkSkip = 1024 * 4;
uint64_t skipped = 0;
while (skipped < args.nSkipBytes) {
    uint64_t offset;
    if (skipped + chunkSkip > args.nSkipBytes) {
        offset = args.nSkipBytes - skipped;
    }
    else {
        offset = chunkSkip;
    }
    int res = fseek(fp, offset, SEEK_CUR);
    if (res != 0) {
        fprintf(stderr, "Could not skip %llu bytes, file may be "
                "too small. Result: %d\n", args.nSkipBytes, res);
        charbuffer_free(printable); 
        charbuffer_free(unprintable); 
        return ECANCELED;
    }
    skipped += offset;
}

について読んだことがあります_fseeki64()が、それは MSVC のみのようですか? そうでない場合は、GCC ソリューションにもっと興味があります。

4

0 に答える 0