使用C在文本文件中返回随机行的最佳方法是什么?它必须使用标准I/O库(<stdio.h>),因为它适用于Nintendo DS自制程序.
<stdio.h>
澄清:
c random file stdio
我有一个包含大量文件的目录(~1mil).我需要从这个目录中选择一个随机文件.由于文件太多,os.listdir自然需要永恒才能完成.
os.listdir
有没有办法可以绕过这个问题?也许以某种方式知道目录中的文件数量(没有列出它)并选择'n'文件,其中n是随机生成的?
目录中的文件是随机命名的.
python file
file ×2
c ×1
python ×1
random ×1
stdio ×1