存储1,000,000条记录
问题描述:
你认为在这里使用文件而不是
链接列表或数组会更好吗?该文件可以组织成一个数组,以便一个
可以索引它吗?
do you think it will be better to use a file over here instead of a
link list or array ? Can the file be organized as an array so that one
can index into it ?
答
lector写道:
lector wrote:
你认为在这里使用文件而不是
链接列表或数组会更好吗?
do you think it will be better to use a file over here instead of a
link list or array ?
如果你有足够的RAM使用它,因为它比磁盘快数千倍b / b $
该文件可以组织为一个数组,以便一个
If you have enough RAM use it since it is thousands of times faster
than a disk.
Can the file be organized as an array so that one
可以索引它吗?
can index into it ?
是。
如果记录大小(在磁盘上)是X,则第5876条记录是偏移的
X * 5875字节。
-
jacob navia
jacob at jacob point remcomp point fr
logiciels / informatique
http://www.cs。 virginia.edu/~lcc-win32
4月7日上午12:32,jacob navia< ja ... @ nospam.comwrote:
On Apr 7, 12:32 am, jacob navia <ja...@nospam.comwrote:
>
是。
如果记录大小(在磁盘上)是X,第5876条记录是偏移的
X * 5875字节。
>
Yes.
If record size (on disk) is X, the 5876th record is at offset
X*5875 bytes.
你能告诉我具体的文件功能吗?
Can you please tell me what file function specifically does this ?
是这个函数
int fseek(FILE * stream,long int offset,int origin);
我不知道是否足以将偏移作为长整数。
Is it this function
int fseek ( FILE * stream, long int offset, int origin );
I don''t know if it sufficient to have offset as a long int.