开发者

How would I go about checking the file system I'm working on in C

I'm making a program and one of the things it needs to do is transfer files. I开发者_StackOverflow would like to be able to check before I start moving files if the File system supports files of size X. What is the best way of going about this?


Go on with using a function like ftruncate to create a file of the desired size in advance, before the moving, and do the appropriate error-handling in case it fails.


There's no C standard generic API for this. You could simply try creating a file and writing junk to it until it is the size you want, then deleting it, but even that isn't guaranteed to give you the info you need - for instance another process might have come and written a large file in between your test and your transfer, taking up space you were hoping to use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜