动C大文件 [英] c handle large file

查看:102
本文介绍了动C大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解析,可能是在大小许多GBS的文件。我想这样做是C.任何人都可以提出任何的方法来做到这一点?

I need to parse a file that could be many gbs in size. I would like to do this in C. Can anyone suggest any methods to accomplish this?

这是我需要打开并解析该文件是一个硬盘驱动器转储,我从我的Mac的硬盘驱动器得到。不过,我计划运行Ubuntu 10.04里面64位的我的程序。同时由于大文件的大小,更优化的方法就更好了。

The file that I need to open and parse is a hard drive dump that I get from my mac's hard drive. However, I plan on running my program inside of 64-bit Ubuntu 10.04. Also given the large file size, the more optimized the method the better.

推荐答案

在双方的* nix和Windows,还有扩展触及文件的大小,将支持大小超过2GB或4GB的的I / O例程。自然地,在底层文件系统也必须支持的文件大。在Windows中,NTFS的做法,但FAT不会为实例。这通常被称为大文件支持。

On both *nix and Windows, there are extensions to the I/O routines that touch file size that will support sizes larger than 2GB or 4GB. Naturally, the underlying file system must also support a file that large. On Windows, NTFS does, but FAT doesn't for instance. This is generally known as "large file support".

这两个程序是最关键的用于这些目的都是 fseek的() FTELL(),这样你可以做整个文件随机访问。否则,一般 fopen()函数 FREAD()朋友们可以做的文件,只要任何规模的顺序访问作为底层操作系统和标准输入输出实现支持大文件。

The two routines that are most critical for these purposes are fseek() and ftell() so that you can do random access to the whole file. Otherwise, the ordinary fopen() and fread() and friends can do sequential access to any size of file as long as the underlying OS and stdio implementation support large files.

这篇关于动C大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆