http://www.cplusplus.com/reference/cstdio/ftell/
点击打开链接
<cstdio>
ftell
long int ftell ( FILE * stream );
Get current position in stream
Returns the current value of the position indicator of the
stream.
For binary streams, this is the number of bytes from the beginning of the file.
For text streams, the numerical value may not be meaningful but can still be used to restore the position to the same position later using fseek (if there are characters put back using ungetc still pending of being read, the behavior is undefined).
Parameters
-
stream
- Pointer to a FILE object that identifies the stream.
Return Value
On success, the current value of the position indicator is returned.On failure, -1L is returned, and errno is set to a system-specific positive value.
Example
| |
This program prints out the size of myfile.txt in bytes (where supported).
本文提供了一个简单的C++程序示例,演示如何使用ftell函数获取文件大小。程序通过打开指定文件,使用ftell函数获取当前位置,并最终打印文件大小。
663

被折叠的 条评论
为什么被折叠?



