如何使用c ++获取文件大小 [英] How to get file size using c++

查看:77
本文介绍了如何使用c ++获取文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//代码是...................

int myfile;

const wchar_t * your_result;

myfile = _wopen(your_result,O_BINARY | _O_RDONLY,_S_IREAD); //使用_wopen打开文件

lseek(myfile,00,SEEK_SET); //使用'lseek搜索'

如何才能获得'myfile'是文件描述符的文件大小?请帮助我

//code is...................
int myfile;
const wchar_t* your_result;
myfile = _wopen(your_result,O_BINARY|_O_RDONLY,_S_IREAD);//open file using _wopen
lseek(myfile,00,SEEK_SET);//seek using 'lseek'
how can i get the file size where 'myfile' is the file descriptor ?pls help me

推荐答案

有一些这里有用的链接:

输入/输出文件 [ ^ ]

如何获取文件大小C ++ [ ^ ]



问候。
Hi, there are some helpful links here:
Input/output with files[^]
How to get file size C++[^]

Regards.


GetFileSize- API

http://msdn.microsoft.com/en-us/library/windows/desktop/aa364955(v = vs.85).aspx [ ^ ]





what about GetFileSize-API
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364955(v=vs.85).aspx[^]

or
#include <sys/stat.h>
struct stat st;
stat(filename, &st);
size = st.st_size;


这篇关于如何使用c ++获取文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆