📄 filesize.lk.html
字号:
<html><!-- Mirrored from c-faq.com/osdep/filesize.lk.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 08:03:13 GMT --><head><title></title></head><body>From: fred@genesis.demon.co.uk (Lawrence Kirby)<br>Newsgroups: comp.lang.c<br>Subject: Re: File size<br>Date: Wed, 23 Jun 99 00:05:27 GMT<br>Message-ID: <930096327snz@genesis.demon.co.uk><p>In article <7ko6mg$66b$1@eskinews.eskimo.com>scs@eskimo.com "Steve Summit" writes:<br>> ...But you're right, SEEK_END is still a kicker.<p>Assuming that it is a real problem (like whether the possibility ofUCHAR_MAX > INT_MAX is a real problem). My guess would be that anyplatform that is capable of determining a precise file size willget SEEK_END right on a binary stream. If you're worried state theassumption in the program documentation but don't lose sleepover it.<p>There are still good reasons not to get a file size e.g.<ol><p><li>the file may not be seekable or even have a size (e.g. input fromconsole/serial port/tty/pipe/socket).<p><li>the file size may change between determining it and making use of it.</ol><p>If however you really do need to find the size of a file (you know tobe a regular file) without actually scanning it end to end there isno more portable way than to use fseek/SEEK_END/ftell on a binary stream.<p><pre>-- -----------------------------------------Lawrence Kirby | fred@genesis.demon.co.ukWilts, England | 70734.126@compuserve.com-----------------------------------------</pre></body><!-- Mirrored from c-faq.com/osdep/filesize.lk.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 08:03:13 GMT --></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -